A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
16
Task/Input-loop/Java/input-loop-2.java
Normal file
16
Task/Input-loop/Java/input-loop-2.java
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
...
|
||||
try{
|
||||
BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));//stdin
|
||||
//new BufferedReader(new FileReader(filename)) for a file
|
||||
//new BufferedReader(new InputStreamReader(socket.getInputStream())) for a network stream
|
||||
while(inp.ready()){
|
||||
String input = inp.readLine();//line-by-line only
|
||||
//in.read() for character-by-character
|
||||
//process the input here
|
||||
}
|
||||
} catch (IOException e) {
|
||||
//There was an input error
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue