输入一行,然后按回车键结束此行的输入

    1. Scanner in = new Scanner(System.in);
    2. String line = in.nextLine();
    3. Scanner in2 = new Scanner(line);
    4. //输入第一行
    5. while (in2.hasNextInt()) {
    6. exp1.add(in2.nextInt());
    7. }
    8. String line1 = in.nextLine();
    9. Scanner in3 = new Scanner(line1);
    10. //输入第二行
    11. while (in3.hasNextInt()) {
    12. exp2.add(in3.nextInt());
    13. }