RosettaCodeData/Task/Input-loop/Java/input-loop-1.java
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

9 lines
299 B
Java

import java.util.Scanner;
...
Scanner in = new Scanner(System.in);//stdin
//new Scanner(new FileInputStream(filename)) for a file
//new Scanner(socket.getInputStream()) for a network stream
while(in.hasNext()){
String input = in.next(); //in.nextLine() for line-by-line
//process the input here
}