java判断字符串回文
2020-07-13 本文已影响0人
酷酷的美猴王
public static void main(String[] args) throws Exception {
String ss = "aghdtdhga";
char[] cc = ss.trim().toCharArray();
int first = 0;
int last = cc.length - 1;
while (first < last) {
if (cc[first++] != cc[last--]) {
System.out.println("false");
}
}
System.out.println("true");
}