Jump Statement is Loop Program – Continue?
This is best work of jump statement in java program.
Using of this statement we can manage the loop program.
Let’s see one example on it.
Our loop is from 1 to 1000.
But we do not need 201 to 300 numbers from loop.
That time continue statement will help in this program.
Program on – Jump Statement – Continue
for(x=1;x<=10;x++) // Loop
if(x==5) // does not give o/p just skip 5 number
System.out.println(“X = ” + x);
System.out.println(“Bye from Method”);
public static void main(String args)
// Create an object of class LoopEx3
LoopEx3 obj = new LoopEx3();
obj.method1(); // call to method1()
System.out.println(“Bye from Main”);
X = 1
X = 2
X = 3
X = 4
Here Skip X = 5 number from loop
X = 6
X = 7
X = 8
X = 9
X = 10
Bye from Method
Bye from Main
In this program, Loop is working till 4 numbers.
Then Skip 5 number then continues till 10 numbers.
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.
|1||Create loop from 65 to 122|
And Display A to Z
Then Skip 91 to 96 number
And Display a to z
Share and Enjoy
902total visits,11visits today