|
|
back to boardhow to determine the end of the console's input with Java THX Re: how to determine the end of the console's input with Java Scanner in; while (in.hasNext()){...} (for String) or while (in.hasNextType()){...} (for Type = Int, Double, Byte, ...) BufferedReader in; int c; while ((c=in.read()) != -1) {...} StreamTokenizer in; in.nextToken(); while (in.ttype != StreamTokenizer.TT_EOF){ ... in.nextToken(); } Edited by author 16.09.2009 00:17 Re: how to determine the end of the console's input with Java i think ,second method(use -1 to end input) can't ac this problem with JAVA, and i try to use first Scanner method to solve it,failed ,and TT_EOF is -1 in nature. Re: how to determine the end of the console's input with Java |
|
|