Looping statement are the statements execute one or more statement repeatedly several number of times. In java programming language there are three types of loops; while, for and do-while.
Why use loop ?
When you need to execute a block of code several number of times then you need to use looping concept in Java language.
Advantage with looping statement
- Reduce length of Code
- Take less memory space.
- Burden on the developer is reducing.
- Time consuming process to execute the program is reduced.
While Loop in Java
In while loop in Java first check the condition if condition is true then control goes inside the loop body otherwise goes outside of the body. while loop will be repeats in clock wise direction.
Syntax :
while(condition) {
Statement(s)
increment / decrements (++ or --);
}
Program:
class whileDemo { public static void main(String args[]) { int i=0; while(i<5) { System.out.println(+i); i++; }Output:
0 2 3 4- Progamming is what actually means ?
- What is software development ?
- How we categorized software development in different manner.
C Programming
C Plus Plus
Python
Java Development
Web Designing
Javascript
Mysql
Oracle
C Plus Plus
Python
Java Development
Web Designing
Javascript
Mysql
Oracle
We cover all the programming concepts in various programming languages, this tutorials are very help full for bigener as well as Experience developer, for the ease of understanding we categorized programming in different manner likewise.