gobi gobi - 1 year ago 80
Java Question

What is the use of System.in.read()?

What is the use of

in java?

Please explain this.

Answer Source

May be this example will help you.

import java.io.IOException;

public class MainClass {

    public static void main(String[] args) {
        int inChar;
        System.out.println("Enter a Character:");
        try {
            inChar = System.in.read();
            System.out.print("You entered ");
        catch (IOException e){
            System.out.println("Error reading from user");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download