this is my first post in here, btw, my teacher has given the class an assignment in programming in which we need to do a palindrome program, i'm able to do it but i wanted to get rid of the error, can you please explain me why there's an error, and how do I get rid of it?
import java.io.*;
public class AssignmentInCopro
{public static void main (String [] args) throws IOException
{BufferedReader x = new BufferedReader(new InputStreamReader(System.in));
String word = "";
System.out.print("Please enter the word you want to see in reverse: ");
word = x.readLine();
int wordLength = word.length();
while (wordLength >=0)
{
char letter = word.charAt(wordLength - 1);
System.out.print(letter);
wordLength--;
}
}
}
wordLength > 0(without the =).