Jump Statement is Loop Program – Return?

This is best work of return statement in java program.

Using of this statement we can manage the loop and method program.

I give one example on it.

Our loop is from 1 to 1000.

But we have to stop loop at 200 number and back to main program.

That time return statement will help us.


Program on – Jump Statement – Return

class LoopEx4


            void method1()


                        int x;

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


                                    if(x==5)                     // return from method1()


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


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



class loop4


          public static void main(String args[])


                   // Create an object of class LoopEx4

                   LoopEx4 obj = new LoopEx4();

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

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




X = 1

X = 2

X = 3

X = 4

Bye from Main


About Program

In this program, Loop is working till 4 numbers.

At 5 number, loop and method both breaks because of if condition

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.

1431total visits,3visits today


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

Related articles

One response to “JUMP STATEMENT IN LOOP PROGRAM – Return”

  1. My brother recommended I might like thi website. He was entirely right.

    This post truly made my day. You cann’t imagine just how much time I hhad
    spent for this information! Thanks!