//This is a sample program for reading a sequence of integers from //keyboard interactive fashion. //Note that it uses two classes of java.io.* package : //InputStreamReader BufferedReader. //The object of class BufferedReader is built using constructor //which has a parameter of type InputStreamReader. //The aim of BufferedReader is that it can read one full line from //console compared to InputStreamReader which reads only one character at a //time. This can be used to read in any primitive type using //the method of converting String to the primitive type. //Notice the method readLine() which returns a string corresponding to //the line entered. import java.io.*; class Interactively_reading_integers { public static void main(String args[]) throws IOException { InputStreamReader inp = new InputStreamReader(System.in); BufferedReader fromKeyboard = new BufferedReader(inp); String s; System.out.println("How many numbers you wish to enter :"); s = fromKeyboard.readLine(); int n = Integer.parseInt(s); int[] A = new int[n]; for(int count=0; count