import java.io.IOException; public class InputStreamDemo1 { public static void main(String[] args) { /* System.in is of class InputStream. The read method of input stream reads one byte and returns an int giving the value of this byte. -1 indicates end of input. */ try { int i; while ((i = System.in.read()) != -1) { //i is in the range 0 to 255 inclusive. System.out.print(i); final char c = (char)i; if (!Character.isISOControl(c)) { System.out.print(" " + c); } System.out.println(); } } catch (IOException e) { System.err.println(e.getMessage()); } } }