Is it possible to assign a variable in a while loop?
I'm looking for a way to use scanner in a for loop, without advancing twice.
String desc = "";
while (!scanner.next().equals("END")) {
desc = desc + scanner.next();
}
As you can see, when scanner.next() is called in the while loop's
condition and inside of the while loop itself. I want it to advance the
scanner only once. Is there any way to do that?
No comments:
Post a Comment