June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,9 +1,25 @@
import java.io.InputStream;
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
public class InputLoop {
public static void main(String args[]) {
// To read from stdin:
InputStream source = System.in;
/*
Or, to read from a file:
InputStream source = new FileInputStream(filename);
Or, to read from a network stream:
InputStream source = socket.getInputStream();
*/
Scanner in = new Scanner(source);
while(in.hasNext()){
String input = in.next(); // Use in.nextLine() for line-by-line reading
// Process the input here. For example, you could print it out:
System.out.println(input);
}
}
}