View Single Post
Old Apr 7th, 2008, 1:31 PM   #7
Fall Back Son
Hobbyist Programmer
 
Join Date: Oct 2006
Posts: 203
Rep Power: 2 Fall Back Son is on a distinguished road
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.
Fall Back Son is offline   Reply With Quote