SlideShare a Scribd company logo
Java Break Statement
Mrs.S.KAVITHA
ASSISTANT PROFESSOR
DEPARTMENT OF COMPUTER SCIENCE
SRI SARADA NIKETAN COLLEGE OF
SCIENCE FOR WOMEN,KARUR.
• When a break statement is encountered inside a loop,
the loop is immediately terminated and the program
control resumes at the next statement following the
loop.
• The Java break statement is used to break loop
or switch statement. It breaks the current flow of the
program at specified condition. In case of inner loop,
it breaks only inner loop.
• We can use Java break statement in all types of
loops such as for loop, while loop and do-while loop.
Syntax:
jump-statement;
break;
Flow chart
Java Program to demonstrate the use of break statement
//inside the for loop.
public class BreakExample {
public static void main(String[] args) {
//using for loop
for(int i=1;i<=10;i++){
if(i==5){
//breaking the loop
break;
}
System.out.println(i);
}
}
Output:
1
2
3
4
Java Continue Statement
• The continue statement is used in loop control
structure when you need to jump to the next iteration
of the loop immediately. It can be used with for loop
or while loop.
• The Java continue statement is used to continue the
loop. It continues the current flow of the program and
skips the remaining code at the specified condition. In
case of an inner loop, it continues the inner loop only.
• We can use Java continue statement in all types of
loops such as for loop, while loop and do-while loop.
Syntax:
jump-statement;
continue;
//Java Program to demonstrate the use of continue statement
//inside the for loop.
public class ContinueExample {
public static void main(String[] args) {
//for loop
for(int i=1;i<=10;i++){
if(i==5){
//using continue statement
continue;//it will skip the rest statement
}
System.out.println(i);
}
}
}
Output:
1
2
3
4
6
7
8
9
10

More Related Content

PPTX
dizital pods session 5-loops.pptx
VijayKumarLokanadam
 
PPTX
Lecture - 5 Control Statement
manish kumar
 
PPTX
Computer programming 2 Lesson 8
MLG College of Learning, Inc
 
PPTX
LOOPING STATEMENTS, JAVA,PROGRAMMING LOGIC
DiwakaranM3
 
PPT
4.CONTROL STATEMENTS_MB.ppt .
happycocoman
 
PPTX
DAY_1.2.pptx
ishasharma835109
 
PPTX
Control statements in java
Madishetty Prathibha
 
PPTX
Loop
prabhat kumar
 
dizital pods session 5-loops.pptx
VijayKumarLokanadam
 
Lecture - 5 Control Statement
manish kumar
 
Computer programming 2 Lesson 8
MLG College of Learning, Inc
 
LOOPING STATEMENTS, JAVA,PROGRAMMING LOGIC
DiwakaranM3
 
4.CONTROL STATEMENTS_MB.ppt .
happycocoman
 
DAY_1.2.pptx
ishasharma835109
 
Control statements in java
Madishetty Prathibha
 

Similar to When a break statement is encountered inside a loop, the loop is immediately terminated and the program control resumes at the next statement following the loop. (20)

PPTX
Java 2.pptx
usmanusman720379
 
PPTX
Programming in java - Concepts- Operators- Control statements-Expressions
LovelitJose
 
PPT
6_A1944859510_21789_2_2018_06. Branching Statements.ppt
RithwikRanjan
 
PPTX
Chapter 5 java
Ahmad sohail Kakar
 
PPTX
Control Statements in Java
Niloy Saha
 
PPTX
Java covers syntax, data types, object-oriented concepts, control flow, excep...
skygennetsis14
 
PPTX
Control flow statements in java
yugandhar vadlamudi
 
PPTX
control statements
Azeem Sultan
 
PDF
csj-161127083146power point presentation
deepayaganti1
 
PDF
Control flow statements in java web applications
RajithKarunarathne1
 
PDF
Java chapter 5
Mukesh Tekwani
 
PPTX
Pi j1.4 loops
mcollison
 
PPT
Java control flow statements
Future Programming
 
PPT
Control statements
raksharao
 
PPTX
controlStatement.pptx, CONTROL STATEMENTS IN JAVA
DrNeetuSharma5
 
PDF
how to write loops in java explained vividly
shadtarq07
 
PPTX
Pj01 5-exceution control flow
SasidharaRaoMarrapu
 
PPT
05. Control Structures.ppt
AyushDut
 
PPTX
Java chapter 3
Abdii Rashid
 
PPT
Control structures
M Vishnuvardhan Reddy
 
Java 2.pptx
usmanusman720379
 
Programming in java - Concepts- Operators- Control statements-Expressions
LovelitJose
 
6_A1944859510_21789_2_2018_06. Branching Statements.ppt
RithwikRanjan
 
Chapter 5 java
Ahmad sohail Kakar
 
Control Statements in Java
Niloy Saha
 
Java covers syntax, data types, object-oriented concepts, control flow, excep...
skygennetsis14
 
Control flow statements in java
yugandhar vadlamudi
 
control statements
Azeem Sultan
 
csj-161127083146power point presentation
deepayaganti1
 
Control flow statements in java web applications
RajithKarunarathne1
 
Java chapter 5
Mukesh Tekwani
 
Pi j1.4 loops
mcollison
 
Java control flow statements
Future Programming
 
Control statements
raksharao
 
controlStatement.pptx, CONTROL STATEMENTS IN JAVA
DrNeetuSharma5
 
how to write loops in java explained vividly
shadtarq07
 
Pj01 5-exceution control flow
SasidharaRaoMarrapu
 
05. Control Structures.ppt
AyushDut
 
Java chapter 3
Abdii Rashid
 
Control structures
M Vishnuvardhan Reddy
 
Ad

More from Kavitha S (9)

PPTX
data link layer is the protocol layer in a program that handles the moving of...
Kavitha S
 
PPTX
Java provides statements that can be used to control the flow of Java code
Kavitha S
 
PPTX
a variable in Java must be a specified data type
Kavitha S
 
PPTX
Inheritance in Java is a mechanism in which one object acquires all the prope...
Kavitha S
 
PPTX
The final keyword in java is used to restrict the user.
Kavitha S
 
PPTX
A constructor in Java is a special method that is used to initialize objects
Kavitha S
 
PPTX
the array, which stores a fixed-size sequential collection of elements of the...
Kavitha S
 
PPTX
A class which is declared with the abstract keyword is known as an abstract c...
Kavitha S
 
PPTX
How to create a two-dimensional array in java
Kavitha S
 
data link layer is the protocol layer in a program that handles the moving of...
Kavitha S
 
Java provides statements that can be used to control the flow of Java code
Kavitha S
 
a variable in Java must be a specified data type
Kavitha S
 
Inheritance in Java is a mechanism in which one object acquires all the prope...
Kavitha S
 
The final keyword in java is used to restrict the user.
Kavitha S
 
A constructor in Java is a special method that is used to initialize objects
Kavitha S
 
the array, which stores a fixed-size sequential collection of elements of the...
Kavitha S
 
A class which is declared with the abstract keyword is known as an abstract c...
Kavitha S
 
How to create a two-dimensional array in java
Kavitha S
 
Ad

Recently uploaded (20)

PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PDF
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PPTX
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PDF
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
DOCX
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 

When a break statement is encountered inside a loop, the loop is immediately terminated and the program control resumes at the next statement following the loop.

  • 1. Java Break Statement Mrs.S.KAVITHA ASSISTANT PROFESSOR DEPARTMENT OF COMPUTER SCIENCE SRI SARADA NIKETAN COLLEGE OF SCIENCE FOR WOMEN,KARUR.
  • 2. • When a break statement is encountered inside a loop, the loop is immediately terminated and the program control resumes at the next statement following the loop. • The Java break statement is used to break loop or switch statement. It breaks the current flow of the program at specified condition. In case of inner loop, it breaks only inner loop. • We can use Java break statement in all types of loops such as for loop, while loop and do-while loop.
  • 5. Java Program to demonstrate the use of break statement //inside the for loop. public class BreakExample { public static void main(String[] args) { //using for loop for(int i=1;i<=10;i++){ if(i==5){ //breaking the loop break; } System.out.println(i); } }
  • 7. Java Continue Statement • The continue statement is used in loop control structure when you need to jump to the next iteration of the loop immediately. It can be used with for loop or while loop. • The Java continue statement is used to continue the loop. It continues the current flow of the program and skips the remaining code at the specified condition. In case of an inner loop, it continues the inner loop only. • We can use Java continue statement in all types of loops such as for loop, while loop and do-while loop.
  • 9. //Java Program to demonstrate the use of continue statement //inside the for loop. public class ContinueExample { public static void main(String[] args) { //for loop for(int i=1;i<=10;i++){ if(i==5){ //using continue statement continue;//it will skip the rest statement } System.out.println(i); } } }