You are on page 1of 5

Table of content [hide]

1 Break Statement in Java Programming Language :


2 Syntax : Break Statement In Java Programming Language
3 Different Ways of Using Break Statement in Java :
3.1 1.Break Statement used in For Loop
3.2 2.Break Statement used in While Loop
3.3 3.Break Statement used in While Loop
3.4 4.Break Statement can also be used in Switch Case

o
o
o
o

Break Statement in Java Programming Language :


1.

Break statement in Java Programming is used to come out of the


loop control statements.

2. Break Statement is used to break : for Loop | while Loop | dowhile loop
3. Break Statements skips remaining statements and execute
immediate statement after loop.
4. Break statement is used whenever our condition is satisfied
inside loop and we have to come outside the loop.
5. Break statement is used to make looping statements more
flexible and provides more power to it.

Syntax : Break Statement In Java Programming


Language
break;

Different Ways of Using Break Statement in Java :


1.Break Statement used in For Loop

break statement will take control out of the loop.


All the statements will gets executed i.e statement 1 , statement 2
. when it encountersbreak statement it will break
loop and take control outside the loop.

In the above diagram break statement will take control outside


the loop . i.e, it will execute OutsideStatement1 next to break.

2.Break Statement used in While Loop

In this example we have written break statement inside while


loop.

Whenever this statement executes then break will move control


outside the while loop.

3.Break Statement used in While Loop

In do while it executes similarly as that of for and while loop.

break statement terminates do while loop.

4.Break Statement can also be used in Switch Case

You might also like