Read from keyboard : Console Read « Development « Java Tutorial






import java.io.IOException;

public class MainClass {

  public static void main(String[] args) {

    try {
      while (true) {
        int datum = System.in.read();
        if (datum == -1)
          break;
        System.out.println(datum);
      }
    } catch (IOException ex) {
      System.err.println("Couldn't read from System.in!");
    }
  }
}








6.3.Console Read
6.3.1.How to read from standard input
6.3.2.Read from keyboard
6.3.3.Getting Data From the Keyboard
6.3.4.Tokenizing a Stream from console input
6.3.5.Read password from console