by "Tim B" <nospam@[EMAIL PROTECTED]
>
May 17, 2008 at 01:42 AM
"Fish" <Fish@[EMAIL PROTECTED]
> wrote in message
news:pccp14d7jbtdurf5dme06n5e7952ji7pue@[EMAIL PROTECTED]
> Could a kind Java code expert take a look at a method for me?
>
> It seems that once called, the method starts out good by
> creating/opening up a file (appending existing files). It hiccups
> when it gets to the do loop. It asks the first question, then without
> waiting for data to be entered, it asks the second question. This
> only happens on the first iteration of the loop.
>
(snip)
> Scanner keyboard = new Scanner(System.in);
> String fileName = keyboard.next();
If you change the above line to :
String fileName = keyboard.nextLine();
the problem goes away. I'm not sure why exactly, but maybe next() leaves
something in the input that is picked up by the first nextLine() in the
loop.