Java编程判断是否是回文数

时间:2014-06-17 13:00:53   收藏:0   阅读:339

import javax.swing.JOptionPane;

自然数中还有一类数被称为回文数。回文数就是一个数的两边对称,如11,121,1221,9339,30203等等


public class CircleTest{


 public static void main(String[] args){


  String inputValue = JOptionPane.showInputDialog("请输入一个整数");


  StringBuffer source = new StringBuffer(inputValue);


  source.reverse();


  String reverseString = new String(source);


  if(reverseString.equals(inputValue)){


   System.out.println("你输入的是回文数");


  }else{


   System.out.println("你输入的不是回文数");


  }


 }


}

Java编程判断是否是回文数,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!