Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
JAVA loop without variable?
for "for" and "while" loop i need to add variable, even when i don't actually need any in code inside of the loop. Is there any loop without need of use such dummy variable?
Using intuition i did try for () and while () but they gave me an error ;)
3 Answers
- cpciiLv 76 years ago
Neither really need a variable for working, ( i can't remember for a for loop exactly) but a while loop can be done as
while (
do something until match your condition
breaK:
)// end while
- Anonymous6 years ago
So you want to make an infinite loop? In that case, just use while (true) { do stuff forever }
- JohnLv 76 years ago
for(;;) { }
do { } while(expression);
while(true) { }
this one you wont understand
collection.stream().forEach(e -> System.out.println(e));