Normally in Java you can type in the console by writing like this
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String someValue = br.readLine();
Systsm.in represents the member variable in in the System class. Objects for standard input and standard output are pre-generated and assigned to System.in and System.out. Therefore, you can use methods such as System.out.println () without creating an input / output object (instance) with new.
System.in handles the raw bytes that are input. Japanese is not processed correctly either. On Windows, Japanese is Unicode inside Java, so it must be converted at the input and output. The * InputStreamReader class * does the conversion.
1st line,
InputStreamReader isr = new InputStreamReader(System.in);
The object isr will do the Japanese conversion for you.
To read line by line
BufferedReader br = new BufferedReader(isr);
You need to connect to an object of class BufferedReader. Since this object has a buffer function, it can be read line by line.
String someValue = br.readLine();
br.readLine () will convert the input line into Japanese and return it. In this way, you can put a line of strings in the buf of the String class.
Recommended Posts