This is a class for a bigger project. I programmed it sepratly so that i know it will work when i include it in the project. This is a Palindrome project. SO i want to know if the a word is a palindrome or not. I get the program to reverse the String, but even when the two string are equal to each other it still test as false. Please Help!
import java.util.*;
public class Palindrome_Idriss
{
public static void main(String[] args)
{
boolean result;
String test = "aba";
StringBuffer reverser = new StringBuffer(test.substring(test.length() - 1, test.length()));
for(int counter = test.length() - 2; counter >= 0; counter--)
{
reverser = reverser.append(test.substring(counter, counter + 1));
}
reverser.toString();
if (reverser.equals(test))
result = true;
else{
result = false;}
System.out.println(result);
System.out.println(test);
System.out.println(reverser);
}
}