i have to read from the following format.
1 12 23 34 So, All inputs are separated by a line.
I have tried the following
br = new Scanner(System.in); num = Integer.parseInt(br.next()); while(br.hasNextInt()) { num = br.nextInt() ; System.out.println(num); } But it is not working as i expected. If i enter first input, it started processing it and prints. it is not waiting for me to enter next line. In C, i can make use of sscanf. but in java i have no idea how to allow user to enter multiline input? plese suggest some ideas