Take the System.out out of the loop
int w=-10;
System.out.println(w);
do {
w++;
}
while (w<=2020);
System.out.println(w-1);
More Related Contents:
- I don't know what's wrong with the do-while loop
- My first for loop
- Printing Binary values using nested loops [closed]
- Creating a program to file criminal cases and then view them, with new case being allowed to add
- Optimizing a while loop in Java
- Sorting ArrayList based on number of duplicates? [closed]
- Java number sign and asterisk [closed]
- How to loop through a HashMap in JSP?
- How does a for loop work, specifically for(;;)?
- Is there a way to access an iteration-counter in Java’s for-each loop?
- In Java, what are the advantages of streams over loops? [closed]
- Enhanced ‘for’ loop causes an ArrayIndexOutOfBoundsException
- How can I include external jar on my Netbeans project
- Display numbers from 1 to 100 without loops or conditions [closed]
- How to loop over a Class attributes in Java?
- Is there any way to do n-level nested loops in Java?
- Increment variable names? [duplicate]
- Netbeans – Build targetting JDK 6 but run using Java 7 JRE
- Should try…catch go inside or outside a loop?
- Null check in an enhanced for loop
- Java: how much time does an empty loop use?
- How do I apply the for-each loop to every character in a String?
- using labels in java without “loops”
- Styling a JavaFX 2 button using FXML only – How to add an image to a button?
- How to flatten all items from a nested Java Collection into a single List?
- querying embedded database in netbeans using derby
- JFreechart Loop through polar chart sectors
- Is it possible see all the references to an object in execution time?
- Java heap space in netbeans.. but I’ve increased the heap size already!
- Remove object from ArrayList with some Object property