标签:判断 oid ann new next scanner 输入 lse system.in
12321 1221
public static void PJ() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个整数:");
int num = sc.nextInt();
String s = num+"";
String s1 ="";
for (int i = s.length()-1; i>=0; i--) {
s1+=s.charAt(i);
}
if (s.equals(s1)) {
System.out.println("是回文数");
}else {
System.out.println("不是回文数");
}
}
public static void generate() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个整数:");
int num = sc.nextInt();
String s = num+"";
String s1="";
for (int i = s.length()-1; i>=0; i--) {
s1+=s.charAt(i);
}
System.out.println("它的回文数是"+s1);
}
标签:判断 oid ann new next scanner 输入 lse system.in
原文地址:https://www.cnblogs.com/fengxia/p/10202399.html