SlideShare a Scribd company logo
youtube: Zooming | https://github.com/Soba-Arjun/
Loop Control
• Statements are executed sequentially.
• Statement 1 >> statement 2 >> …
• Types of loops
1. For loop
2. While loop
3. Do while loop
4. Nested for loop
youtube: Zooming | https://github.com/Soba-Arjun/
Loop Control – For Loop
• It uses when a number of iteration is fixed.
youtube: Zooming | https://github.com/Soba-Arjun/
Syntax:
for(init;condition;incr/decr)
{
// code to be executed
}
Example:
for(int i;i<10;i++)
{
System.out.println(i);
}
Loop Control – While Loop
• It uses when a number of iteration is not fixed.
youtube: Zooming | https://github.com/Soba-Arjun/
Syntax:
while(condition)
{
// code to be executed
}
Example:
int i=1;
while(i<10)
{
System.out.println(i);
i++;
}
Loop Control – Do While Loop
• It uses when a number of iteration is not fixed and execute at least one.
youtube: Zooming | https://github.com/Soba-Arjun/
Syntax:
do
{
// code to be executed
}
while(condition)
Example:
int i=1;
do
{
System.out.println(i);
i++;
}
while(i<10)
Loop Control – Nested For Loop
• Loop inside of another loop.
• Inner loop executes completely
whenever outer loop executes.
youtube: Zooming | https://github.com/Soba-Arjun/
Example:
for(int i=0;i<10;i++)
{
for(int j=0;j<=i;i++)
{
System.out.println(“* ”);
}
System.out.println(); //new line
}
Loop Control Statement ( break; )
• Loop terminated immediately
when break statement
encountered.
youtube: Zooming | https://github.com/Soba-Arjun/
Loop Control Statement ( continue; )
• It uses when we need to jump from the current iteration.
youtube: Zooming | https://github.com/Soba-Arjun/
Example:
for(int i=0;i<10;i++)
{
if(int i==5)
{
continue;
}
System.out.println(i);}

More Related Content

PPTX
Hello git - a soft introduction to git (Talk Slides)
ODP
GIT: a Gentle InTroduction
PPTX
Introduction to Gitlab | Gitlab 101 | Training Session
PDF
Koji and pulp
PDF
Git hooks for front end developers
PPTX
Git hooks
KEY
20120524 english lt2_pythontoolsfortesting
PDF
Git hooks
Hello git - a soft introduction to git (Talk Slides)
GIT: a Gentle InTroduction
Introduction to Gitlab | Gitlab 101 | Training Session
Koji and pulp
Git hooks for front end developers
Git hooks
20120524 english lt2_pythontoolsfortesting
Git hooks

What's hot (6)

PDF
[124] mit cheetah 로봇의 탄생
PDF
Migrating to Symfony 3.0
KEY
Git isthenewsexy
PDF
Git in the Van HighEdWeb 2013
KEY
Introduction to Git
PPT
Open shift intro for Philly PUG
[124] mit cheetah 로봇의 탄생
Migrating to Symfony 3.0
Git isthenewsexy
Git in the Van HighEdWeb 2013
Introduction to Git
Open shift intro for Philly PUG
Ad

Similar to Java loop control (20)

PPTX
Iteration statements.pptxjdjdjsksodhdjsnsk
PPTX
Loop(for, while, do while) condition Presentation
PDF
LOOPS in C Programming Language - Technology
PPT
Control structures repetition
PDF
how to write loops in java explained vividly
PPTX
Looping (Computer programming and utilization)
PDF
Introduction to GitHub Actions
PPTX
Java do-while Loop
PPT
Chapter 5 Looping
PPTX
Looping statements
PPTX
Lesson 6 Understanding Loops and Conditional Statements.pptx
PDF
Puppet Camp Duesseldorf 2014: Toni Schmidbauer - Continuously deliver your pu...
PDF
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
PPTX
Loops In C++
PPTX
PPTX
Loops in c ii
PPTX
Loops in c ii
PPTX
Decision Making & Loops
PDF
Chapter 12 Computer Science ( ICS 12).pdf
Iteration statements.pptxjdjdjsksodhdjsnsk
Loop(for, while, do while) condition Presentation
LOOPS in C Programming Language - Technology
Control structures repetition
how to write loops in java explained vividly
Looping (Computer programming and utilization)
Introduction to GitHub Actions
Java do-while Loop
Chapter 5 Looping
Looping statements
Lesson 6 Understanding Loops and Conditional Statements.pptx
Puppet Camp Duesseldorf 2014: Toni Schmidbauer - Continuously deliver your pu...
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Loops In C++
Loops in c ii
Loops in c ii
Decision Making & Loops
Chapter 12 Computer Science ( ICS 12).pdf
Ad

More from Soba Arjun (20)

PDF
Java interview questions
PDF
Java modifiers
PDF
Java variable types
PDF
Java basic datatypes
PDF
Dbms interview questions
PDF
C interview questions
PDF
Technical interview questions
PDF
Php interview questions with answer
PDF
Computer Memory Types - Primary Memory - Secondary Memory
PDF
Birds sanctuaries
PDF
Important operating systems
PDF
Important branches of science
PDF
Important file extensions
PDF
Java Abstraction
PDF
Java Polymorphism
PDF
Java Overriding
PDF
Java Inner Classes
PDF
java Exception
PDF
Java Methods
PDF
java Inheritance
Java interview questions
Java modifiers
Java variable types
Java basic datatypes
Dbms interview questions
C interview questions
Technical interview questions
Php interview questions with answer
Computer Memory Types - Primary Memory - Secondary Memory
Birds sanctuaries
Important operating systems
Important branches of science
Important file extensions
Java Abstraction
Java Polymorphism
Java Overriding
Java Inner Classes
java Exception
Java Methods
java Inheritance

Recently uploaded (20)

PDF
RMMM.pdf make it easy to upload and study
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Computing-Curriculum for Schools in Ghana
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Pre independence Education in Inndia.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
master seminar digital applications in india
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Classroom Observation Tools for Teachers
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
Anesthesia in Laparoscopic Surgery in India
RMMM.pdf make it easy to upload and study
Microbial disease of the cardiovascular and lymphatic systems
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Computing-Curriculum for Schools in Ghana
human mycosis Human fungal infections are called human mycosis..pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Pre independence Education in Inndia.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
master seminar digital applications in india
Supply Chain Operations Speaking Notes -ICLT Program
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Pharma ospi slides which help in ospi learning
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Classroom Observation Tools for Teachers
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
01-Introduction-to-Information-Management.pdf
Cell Structure & Organelles in detailed.
Anesthesia in Laparoscopic Surgery in India

Java loop control

  • 1. youtube: Zooming | https://github.com/Soba-Arjun/
  • 2. Loop Control • Statements are executed sequentially. • Statement 1 >> statement 2 >> … • Types of loops 1. For loop 2. While loop 3. Do while loop 4. Nested for loop youtube: Zooming | https://github.com/Soba-Arjun/
  • 3. Loop Control – For Loop • It uses when a number of iteration is fixed. youtube: Zooming | https://github.com/Soba-Arjun/ Syntax: for(init;condition;incr/decr) { // code to be executed } Example: for(int i;i<10;i++) { System.out.println(i); }
  • 4. Loop Control – While Loop • It uses when a number of iteration is not fixed. youtube: Zooming | https://github.com/Soba-Arjun/ Syntax: while(condition) { // code to be executed } Example: int i=1; while(i<10) { System.out.println(i); i++; }
  • 5. Loop Control – Do While Loop • It uses when a number of iteration is not fixed and execute at least one. youtube: Zooming | https://github.com/Soba-Arjun/ Syntax: do { // code to be executed } while(condition) Example: int i=1; do { System.out.println(i); i++; } while(i<10)
  • 6. Loop Control – Nested For Loop • Loop inside of another loop. • Inner loop executes completely whenever outer loop executes. youtube: Zooming | https://github.com/Soba-Arjun/ Example: for(int i=0;i<10;i++) { for(int j=0;j<=i;i++) { System.out.println(“* ”); } System.out.println(); //new line }
  • 7. Loop Control Statement ( break; ) • Loop terminated immediately when break statement encountered. youtube: Zooming | https://github.com/Soba-Arjun/
  • 8. Loop Control Statement ( continue; ) • It uses when we need to jump from the current iteration. youtube: Zooming | https://github.com/Soba-Arjun/ Example: for(int i=0;i<10;i++) { if(int i==5) { continue; } System.out.println(i);}