What is the End Of File/Stream keyboard combination to use with System.in.read()
问题 Apologize if this trivial question has already been answered, I cannot find it at SO. Reading lines from the IDE console with this Java trivial code (Windows 7 and Eclipse Kepler): int v; try { while ((v = System.in.read()) != -1) System.out.println(v); } catch (IOException e) { ; } How the user can make the value v equal to -1? (I've tried Ctrl + d - z - x - c - s - e and other keys without repeatable behavior, but the loop is interrupted randomly) 回答1: Control + D should send the EOF