50,528
社区成员
发帖
与我相关
我的任务
分享
private static Scanner sca;
private static Scanner inp;
static String bye;
public static void main(String[] args) {
sca = new Scanner(System.in);
System.out.print("Enter some integers (911 for break!): ");
ArrayList<Integer> al = new ArrayList<Integer>();
while (true) {
al.add(sca.nextInt());
System.out.println("Is that enough? (Y/N)");
bye = inp.nextLine();
if (bye.equals("Y") || bye.equals("y")) {
break;
}
}
}
private static Scanner sca;
// private static Scanner inp;
static String bye;
public static void main(String[] args) {
sca = new Scanner(System.in);
System.out.print("Enter some integers:");
ArrayList<Integer> al = new ArrayList<Integer>();
while (true) {
al.add(sca.nextInt());
if (al.contains(911)) {
break;
}
}