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,16 +1,31 @@
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
import java.io.Reader;
public class InputLoop {
public static void main(String args[]) {
// To read from stdin:
Reader reader = new InputStreamReader(System.in);
/*
Or, to read from a file:
Reader reader = new FileReader(filename);
Or, to read from a network stream:
Reader reader = new InputStreamReader(socket.getInputStream());
*/
try {
BufferedReader inp = new BufferedReader(reader);
while(inp.ready()) {
int input = inp.read(); // Use in.readLine() for line-by-line
// Process the input here. For example, you can print it out.
System.out.println(input);
}
} catch (IOException e) {
// There was an input error.
}
}
}