Over 500 Magazines for FREE!

Yes! You can subscribe to ALL of them. They will be shipped to your home FREE of cost!
Kindly click here to apply!

While Loop

While loop executes group of Java statements as long as the boolean condition evaluates to true.

While loop syntax

  1. while(<boolean condition>){
  2.  
  3. <Block of statements>;
  4.  
  5. }

Block of statements is any valid Java code. Boolean condition is any valid Java expression that evaluates to boolean value. Braces are options if there is only one statement to be executed.

While loop evaluates the boolean expression, and if it is true, it executes the block of statements. It continuously executes the block of statements until the boolean condition evaluates to false value. After that loop is terminated and statement immediately after the loop body will be executed.

While Loop Examples

la...

i need sample progrm not just like explaining it..i need code plz..before thursday..

I nid the codes

i need the codes not the explanation...... T_T

Post new comment

To combat spam, please enter the code in the image.




Do you have a better example?
We're sure you have hundreds of Java program examples.

Spare some time and submit your java example here even if you think it's too small to contribute.

Could not find what you are looking for? Search Java Examples




Feel Tired? Read Jokes & Inspirational Stories, Play Games!