|
Re: Using ctrl+d to end input
Like was already said, the hasNext type methods will check to see if there is input that matches and once there isn't it will terminate the loop. for example
while ( keyboard.hasNextInt() )
{
keyboard.nextInt();
System.out.println("read in an integer");
}
if you enter something like a-z, it will terminate. or you can press ctrl+z for windows and it will terminate. If you're looking for the simplest solution that answers your question. If you're stuck on figuring out why ctrl+d isn't working I'm not sure.
|