日期:2014-05-20 浏览次数:20782 次
import java.util.*;
public class TestIn {
public static void main(String[] args) {
boolean b = true;
while(b) {
Scanner s = new Scanner(System.in);
System.out.print("“1”:继续 “2”:退出 请输入: ");
if(s.nextInt() == 1) continue;
if(s.nextInt() == 2) {
b = false;
}
}
}
}
试试
import java.util.*;
public class TestIn {
public static void main(String[] args) {
boolean b = true;
while(b) {
Scanner s = new Scanner(System.in);
System.out.print("“1”:继续 “2”:退出 请输入: ");
int num = s.nextInt();
if(num == 1) continue;
if(num == 2) {
b = false;
}
}
}
}