In C++ if I wish to read input till the EOF I can do it in the following manner
while(scanf(\"%d\",&n)) { A[i]=n; i++; }
I can
In Java, One way of reading till EOF is:-
Scanner scan = new Scanner(System.in); while(scan.hasNextLine()) //read until condition is true { String line = scan.nextLine(); System.out.println(line); i++; }