This is my function
public static String isPalindrome(String str) {
String test = "";
String anotherStirng="";
for (int i = str.length()-1; i >= 0; i--) {
test = test + str.charAt(i);
}
return anotherStirng = (str.equals(test) ? "yes" : "no");
}
main is here ...
Scanner scanner = new Scanner(System.in);
int numberOfInput = scanner.nextInt();
String str ="";
String result="";
for (int i=0;i<numberOfInput;i++){
str = scanner.nextLine();
result = isPalindrome(str);
System.out.println(result);
when i enter number of input in the console like 3 or 4, it automatically say "yes" after that its works fine