- public class Demo1
- {
- public static void main(String[] args)
- {
- System.out.println(isDuichenStr("mnanm"));
- }
-
- public static boolean isDuichenStr(String s)
- {
- StringBuilder oldStr=new StringBuilder(s);
- StringBuilder newStr=new StringBuilder(s);
- newStr.reverse();
- return new String(oldStr).equals(new String(newStr));
- }
- }
复制代码
发现一个简单的写法。。突然觉的自己以前好2B。。 |
|