This shows you the differences between two versions of the page.
java:loops:while [2013/04/11 08:43] 188.102.46.48 created |
java:loops:while [2024/02/16 01:04] (current) |
||
---|---|---|---|
Line 8: | Line 8: | ||
</code> | </code> | ||
- | a while loop do something while condition is false | + | a while loop do something while a condition |
===== example of while loop in java ===== | ===== example of while loop in java ===== | ||
Line 17: | Line 17: | ||
public static void main(String[] args) { | public static void main(String[] args) { | ||
- | // TODO code application logic here | + | |
int i=4; | int i=4; | ||
+ | |||
+ | while(i==4) { | ||
- | do { | + | i++; |
- | i++; | + | } |
- | } while(i==4); | + | |
- | + | ||
System.out.println("i is :" + i ); | System.out.println("i is :" + i ); | ||
} | } |