do while loop example java
Example 1: java do while
do {
// loop content
} while (/* condition */);
Example 2: do statement java
class DoWhileLoopExample2 {
public static void main(String args[]){
int arr[]={2,11,45,9};
//i starts with 0 as array index starts with 0
int i=0;
do{
System.out.println(arr[i]);
i++;
}while(i<4);
}
}