java - How to read inputs from console -
i have read following format.
1 12 23 34
so, inputs separated line.
i have tried following
br = new scanner(system.in); num = integer.parseint(br.next()); while(br.hasnextint()) { num = br.nextint() ; system.out.println(num); }
but not working expected. if enter first input, started processing , prints. not waiting me enter next line. in c, can make use of sscanf. in java have no idea how allow user enter multiline input? plese suggest ideas
try
br = new scanner(system.in);
while (true) { int num = integer.parseint(br.nextline()); system.out.println(num); }
Comments
Post a Comment