Loop is used to complete a repetitive task. Suppose, you have to print your name 100 times, then the command you use is:
System.out.println(“Susmita”);
So, instead of writing the same code 100 times, we can write few lines and the job is done. In java there are three types of loop:
1. While
2. Do-while
3. For
Syntax:
type variable=starting value;
while(condition to stop)
{
Statements to repeat;
Increment/Decrement;
}
#coding #javaprogramming #javatutorial #bluej
Негізгі бет While Loop In Java My Study Hacks
Пікірлер