您总是会两次阅读该行(除非您收到
*)
if(scan.nextLine().equals("*")) // read here - "someString" break;words.add(scan.nextLine()); // ignore last read line and read again.您只阅读一次,然后进行比较。
String value = scan.nextLine();// check for null / empty hereif (value.equals("*")) break;words.add(value);


