Standard Console Input Java

Standard Console Input Java


Standard Console Input Java; Java supports user input in three ways of from command line, keyboard and GUI.
Following Example is on Standard Console Input Java takes input from User

Standard Console Input JavaOutput Screenshot on Standard Console Input Java

InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);

System.in implicitly gets connected to input mechanism of OS. BufferedReader connects to System.in through InputStreamReader class. readLine() reads keyboard input and returns as a string. Even numbers like basic salary and house rent are returned as strings. The strings are to be parsed to numbers to be used in arithmetic operations.

More programs are available on the following links.

1. Byte streams – With DataInputStream
2 Character streams – With BufferedReader
3. java.util class – Scanner

The last one is easy to write as no parsing is required, but the client should have at least JDK 1.5 version.

Leave a Reply

Your email address will not be published. Required fields are marked *