I have two methods that ask for input from the keyboard. In one method it works fine. In the other I get the error:
Exception in thread "main" java.util.NoSuchElementException: No line found at java.util.Scanner.nextLine(Unknown Source)
Here are the methods:
This one works fine
public static int logon(Connection conn,boolean flag) throws Exception{
Scanner kboard = new Scanner(System.in);
boolean exit = false;
int usr = -1,
spaces = 0,
commaChk = 0;
String input;
String[] tokens = new String[3];
//ask for user input
do{
printHeader(0);
System.out.print( "Please enter first name, last name and password to logon or create a new account \n" +
"use a space to seperate entries, no commas : ");
input = kboard.nextLine();
if(input.length() == 0) exit = true;
This one returns the error
public static int generalPrompt()throws Exception{
Scanner kboard = new Scanner(System.in);
String input;
int selection = 0;
String[] myInts ={"1","2","3","4","5","6"};
boolean goodInput = false;
do{
printHeader(0);
printHeader(1);
System.out.print("\n\n Select number from above ([return] to exit) : ");
input = kboard.nextLine();
if (input.length() == 0){