首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

java判断是不是是回文字符

2013-02-19 
java判断是否是回文字符public class PalindromeTest {public static void main(String[] args) {isPalidr

java判断是否是回文字符

public class PalindromeTest {   public static void main(String[] args) {           isPalidrome("abcdedcba") ;    }   public static void isPalidrome(String str){       char[] ch = str.toCharArray();       int len = ch.length;       for (int i = 0, int j = len - 1; i <= j;) {           if (ch[i++] == ch[j--]) {           } else {                System.out.println("this string is not palindrome!");                break;          }       }   }}

?

热点排行