
Scanner s = new Scanner(System.in);
l:while(true) {
System.out.println("请输入一只整数");
int a = s.nextInt();
System.out.println(a % 10);
System.out.println("是否继续?(Y:是/N:否)");
while(true) {
String str = s.nextLine();
if(str.equalsIgnoreCase("Y")) {// 忽略大小写相等Y
break;
} else if(str.equalsIgnoreCase("N")) {// 忽略大小写相等N
break l;
} else {
System.out.println("请输入Y/N");
}
}
}
// 看不懂找我,去吃饭了。。。
l:while(true) {
System.out.println("请输入一只整数");
int a = s.nextInt();
System.out.println(a % 10);
System.out.println("是否继续?(Y:是/N:否)");
while(true) {
String str = s.nextLine();
if(str.equalsIgnoreCase("Y")) {// 忽略大小写相等Y
break;
} else if(str.equalsIgnoreCase("N")) {// 忽略大小写相等N
break l;
} else {
System.out.println("请输入Y/N");
}
}
}
// 看不懂找我,去吃饭了。。。