Whenever you use nextInt()
, you need to put nextLine()
after it
System.out.print("How many seats: ");
seat = sc.nextInt();
sc.nextLine();
System.out.print("Enter number of candidates: ");
maxcan = sc.nextInt();
sc.nextLine();
This will consume the unconsumed \n
character from stream