Please see below code for Do While Loop 

				
					package practice;

public class DoWhileLoop {

	public static void main(String[] args) {
		int i = 1;
		
		do {
			
			i = i + 1;		
			System.out.println(i);
			
		}while(i < 5);
			
		//System.out.println(i);

	}

}

				
			

Explaination

1
2
3
4
5
After loop = 5

Scroll to Top