Check out example codes for "while loop in java". It will help you in understanding the concepts better.

Code Example 1

int i = 0;
while (i < 5) {
  System.out.println(i);
  i++;
}

Code Example 2

while(i < 5) //while i < 5 stay in the loop
{
  System.out.print(i);
  i++;
}
/*
	do someting
	change variable
    call methods
    etc...
*/

Code Example 3

//runs as long as the condition is true
while(condition){
//do what you want in here
doStuff()
}

Code Example 4

A while loop iterates a block of statements until condition is true. In a 
while loop condition is executed first.
Syntax:

while(condition)
{
   // code goes here
}

Code Example 5

package com.journaldev.javadowhileloop;

public class JavaDoWhileLoop {

	public static void main(String[] args) {

		int i = 5;
		do {
			System.out.println(i);
			i++;
		} while (i <= 10);
	}
}

Code Example 6

int i = 0;
while (i < 5) {
  System.out.println(i);
  i++;
}

Learn ReactJs, React Native from akashmittal.com