Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

cannot resolve symbol error is driving me insane

843810Apr 4 2005 — edited Apr 5 2005
here's what I'm getting

/tmp/31686/palindrome.java:17: cannot resolve symbol
symbol : method subString (int,int)
location: class java.lang.String
else if ( e == g[b] .
subString(0, g.length() -2))

/tmp/31686/palindrome.java:30: cannot resolve symbol
symbol : method subString (int,int)
location: class java.lang.String
g = g[b] . subString(0, g.length() -3);

/tmp/31686/palindrometest.java:9: cannot resolve symbol
symbol : constructor palindrome (java.lang.String,java.lang.String)
location: class palindrome
palindrome test = new palindrome (g,e);

3 errors

and here's my code
import javax.swing.*;
class palindrometest
{ 
	public static void main(String args[])
	{
		
		String g = JOptionPane.showInputDialog("Enter a palindrome");
		String e = "";
		palindrome test = new palindrome (g,e);
	}	
}
import javax.swing.*;
class palindrome
{
	public static String palindrome (String g, String e)
	{
		
		boolean pali = false;
		String result = "That is a " + pali + " palindrome";
	

		if ( e == g )
		{
			pali = true;
			JOptionPane.showMessageDialog(null,result); 
		}
		else if ( e == g.subString(0, g.length() -2))
		{
			pali = true;
			JOptionPane.showMessageDialog(null,result); 
		}
		else if ( g == "")
		{
			pali = true;
			JOptionPane.showMessageDialog(null,result);
		}
		else
		{
			e = e.concat(Character.toString(g.charAt(g.length()-1)));
			g = g.subString(0, g.length() -3);
			palindrome ( g, e); 

		}
	}

}
			
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 3 2005
Added on Apr 4 2005
2 comments
489 views