+ 2
Having error in a java program
2 Answers
+ 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
+ 2
I dont think that you can use same stream on different Scanner objects