java.3
2020-12-13 15:09
标签:bool scanner ack substring boolean ann util als can java.3 标签:bool scanner ack substring boolean ann util als can 原文地址:https://www.cnblogs.com/123-haozijia/p/11574257.html
public class Palindrome {
static String s;
public static char c[]=new char[100];
static int a=s.length();
@SuppressWarnings("unused")
public static void main(String[] args){
@SuppressWarnings("resource")
Scanner scan=new Scanner(System.in);
System.out.println(zifuchuanS(s));
}
public static boolean zifuchuanS(String s){
if(a==0||a==1){
System.out.println("该字符串回文");
}
else{
char first=s.charAt(0);
char last=s.charAt(a-1);
if(first!=last){
return false;
}
}
return zifuchuanS(s.substring(1,a-1));
}
}