WHILE LOOP:-
The Java while loop is used to iterate a part of the program repeatedly until the specified Boolean condition is true. As soon as the Boolean condition becomes false, the loop automatically stops.
SYNTAX:-
while(condition){
//code to be executed
increment/decrement statement
}
EXAMPLE:-
public class example{
public static void main(String args[]){
int i=1;
while(i<=10){
System.out.println(i);
i++;
}
}
}
0 Comments