Re: Help with a loop
- From: "Tim B" <nospam@xxxxxxxxxx>
- Date: Sat, 17 May 2008 01:42:22 GMT
"Fish" <Fish@xxxxxxxxxxx> wrote in message
news:pccp14d7jbtdurf5dme06n5e7952ji7pue@xxxxxxxxxx
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.
.
- References:
- Help with a loop
- From: Fish
- Help with a loop
- Prev by Date: Re: Visa blocking network connections?
- Next by Date: Re: DataValidator class?
- Previous by thread: Re: Help with a loop
- Next by thread: problem: security using IDE's appletviewer
- Index(es):
Relevant Pages
|
|