Standard I/O Example

This code reads in user input from the keyboard and prints it to the screen.

import java.io.*;


class ReadWrite {

  
    public static void main(String args[]) throws IOException {

       int value;
       
       //keystrokes are ASCII integers
       //read in one character at a time until end of data
       // NOte: read method returns -1 when end of data
       while (( value = System.in.read() )  != -1)  {
             //print out the character not the number value.
             System.out.print((char) value);
       }

}