Number Of Page View:100,000+/Months
LOGIN |New User


Using while Loops
while loop bassiclaly use when we dont know whats the no of times statement will be executed but in the case of while loop we can say that the how many times statements are will be execute that senerio will me fillowing here : 
int x = 2;
while(x == 2) {
          in that case ethe statement must evaluate to a boolean result .any variable used in the expression of a while loop must be declared befire the expression will be evauated .we can also say like this : 
while (int x = 2) { }
the ody of while loop will only execute if the condition result is a true value.The key point to remember about a while loop is that it might not ever run. If the test expression is false the first time the while expression is checked, the loop body will be skipped and the program will begin executing at the first statement after the while loop.we have a some code is there : 
int x = 8;
while (x > 8) {
System.out.println("in the loop");
x = 10;
System.out.println("past the loop");
Running this code produces
past the loop
Posted By: Name:Rajesh Kr URL: Using while Loops