Jump Statement in Loop Program – Break

Jump Statement is Loop Program – Break?

This is best work of break statement in java program.

Using of this statement we can control the loop program.

I give one example on it.

Our loop is from 1 to 1000.

But we have to stop loop in 100 Number.

That time break statement will help us.


Introduce Simple Class Example in this blog. But do not take seriously class example just focus on jump statement.


Program on – Jump Statement – Break

class LoopEx2


            void method1()


                        int x;

                        for(x=1;x<=10;x++)          // Loop


                                    if(x==5)                     // Break the loop


                                    System.out.println(“X = ” + x);


System.out.println(“Bye from Method”);



class loop2


          public static void main(String args[])


                   // Create an object of class LoopEx2

                   LoopEx2 obj = new LoopEx2();

                    obj.method1(); // call to method1()

                   System.out.println(“Bye from Main”);




X = 1

X = 2

X = 3

X = 4

Bye from Method

Bye from Main


About Program

In this program, Loop is working till 4 numbers.

At 5 number, loop breaks because of if condition.

Then program print “Bye from Method” statement

Then program reach at main program and then print “Bye from Main”


You can see this program on YouTube


List of Jump Statement Tutorial.

1Work on same example. [Using Command Line Argument]


If you have problem on this blog, you can directly comment on it. This tutorial will help you understand the concepts of java loop programs.

1019total visits,2visits today


Hello, I am Maddy a Java blogger, trainer and developer

Related articles

Comments are closed.