hello can you help me i make a program that will determine palindrome words using array...how can i determine if my words are palindrome...
example if i input:
radar == radar-->this is palindrome
so if i input this
notice--->this will print not a palindrome
please help me here is my code...
String []pal=new String[1];
boolean found=false;
int forward;
int backward;
int i;
System.out.println("Input palindrome");
for( i=0;i<pal.length;i++)
{
pal[i]=console.next();
}
System.out.println(Arrays.toString(pal));
forward = 0;
backward=pal.length-1;
while(forward<=backward)
{ if(pal[i].charAt(forward)!=pal[i].charAt(backward))
found=true;
forward++;
backward--;
break;
}
if(found)
System.out.println(" palindrome");
else
System.out.println("not palindrome");
}
}