A while loop statement in Java programming language repeatedly executes a target statement as long as a given condition is true.
The syntax of a while loop is −
Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and true is any non zero value.
When executing, if the boolean_expression result is true, then the actions inside the loop will be executed. This will continue as long as the expression result is true.
When the condition becomes false, program control passes to the line immediately following the loop.
Here, key point of the while loop is that the loop might not ever run. When the expression is tested and the result is false, the loop body will be skipped and the first statement after the while loop will be executed.
This will produce the following result −
Java Related Interview Questions
|File Maker Interview Questions||J2EE Interview Questions|
|Core Java Interview Questions||Android Interview Questions|
|JavaServer Faces (JSF) Interview Questions||Java Swing Interview Questions|
|JavaMail API Interview Questions||Java collections framework Interview Questions|
|Java 8 Interview Questions||Java Collections Interview Questions|
|Java Exception Handling Interview Questions||Java Concurrency Interview Questions|
|Java String Interview Questions||Java Hadoop Developer Interview Questions|
|Java Serialization Interview Questions||Java Programmer Interview Questions|
|Java Inheritance Interview Questions||Java IO Interview Questions|
|Hadoop Testing Interview Questions|
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.