can u plz explain the error occuring in this code ?
import java.util.*;
public class Main {
public boolean isPalindrome(String str){
String s;
String result;
for(int i=str.length()-1;i>0;i–){
s=""+str.charAt(i);
}
if(s.equals(str))
return true;
else
return false;
}
public static void main(String args[]) {
// Your Code Her
Main m = new Main();
String str;
Scanner sc = new Scanner(System.in);
str = sc.nextLine();
m.isPalindrome(str);
}
}