Java编程判断是否是回文数

时间:2014-06-17 13:01:13   收藏:0   阅读:455

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

原文:http://www.cnblogs.com/Miss-Lee/p/3791687.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!