2nd Nov 2018, 8:34 AM
Yoo Jas
Yoo Jas - avatar
2 Respuestas
+ 6
Only use one Scanner, you don't need so many. Scanner s1= new Scanner(System.in); String name= s1.next(); /*enter a name*/ //Scanner s2 = new Scanner(System.in); int roll =s1.nextInt(); /*enter roll no*/ //Scanner s3 = new Scanner(System.in); String clas = s1.next(); /*entering class*/ //Scanner s4= new Scanner(System.in); char section = s1.next().charAt(0); Also please adjust the tags, so that someone else can find it when they have a similar question :) e.g. scanner, java
2nd Nov 2018, 8:45 AM
Matthias
Matthias - avatar
+ 2
I dont think that you can use same stream on different Scanner objects
2nd Nov 2018, 8:50 AM
KrOW
KrOW - avatar