try {
File file = new File("data.txt");
BufferedReader reader = new BufferedReader(new FileReader(file));
String line;
while((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch(IOException e) {
e.printStackTrace();
}
import java.io.BufferedReader;
//
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println(reader.readLine());
// best answer is to look at documentation from Oracle
https://docs.oracle.com/javase/8/docs/api/java/io/BufferedReader.html
import.java.io.BufferedReader;
public static String IN() {
java.io.BufferedReader d = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
String str = "";
try {
str = d.readLine();
} catch (Exception e) {
e.printStackTrace();
}
return str;
}