string.length not working properly in java
Hi I have a code that checks if a string is palindrome or not.the code is like this: package ProjeTarahi; import java.util.*; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; import java.lang.String; public class Main { public boolean CheckIsSymmetric(String s) { if (s.length()<=1) { return true; } if (s.charAt(0)==s.charAt(s.length()-1)) { String sub = s.substring(1,s.length()-2); return CheckIsSymmetric(sub); } else { return false; } } public static void main