In this tutorial, we will learn about Jumping statements in Java. Jumping statements are also part of control statements in Java. Jumping statements are used to send execution control to a specific statement in Java. Here we will learn three jumping statements in Java.
- break
- continue
- return
break statement: Break statement is used to break the normal flow of execution control. we use break statement normally with switch statements in cases and in loops to break loop based on the specific condition. Always keep in mind we can not use break statement outside the loop or switch statement.
class BreakExample
{
public static void main(String[] args){
for(int i=0; i<10; i++){
if(i==5){
break;
}
System.out.println(i);
}
System.out.println("outside of for loop");
}
}
continue statement: Continue statement with loops. It is so simple when continue statement encountered it simply skip the current iteration of the loop and move to the next iteration. If there is any other statement after continue statement that will not execute. Check this example.
class ContinueExample
{
public static void main(String[] args){
for(int i=1; i<=10; i++){
if(i==5||i==7){
continue;
}
System.out.println(i);
}
}
}
return statement: Return statement we use with methods in java. The main motive of the return statement is to return value to its caller. Check this example.
class ReturnExample
{
public static void main(String[] args){
int result = new ReturnExample().sum(10,15);
System.out.println("Result is = "+result);
}
int sum(int a,int b){
return a+b;
}
}
Parvesh Sandila is a results-driven tech professional with 8+ years of experience in web and mobile development, leadership, and emerging technologies.
After completing his Master’s in Computer Applications (MCA), he began his journey as a programming mentor, guiding 100+ students and helping them build strong foundations in coding. In 2019, he founded Owlbuddy.com, a platform dedicated to providing free, high-quality programming tutorials for aspiring developers.
He then transitioned into a full-time programmer, where his hands-on expertise and problem-solving skills led him to grow into a Team Lead and Technical Project Manager, successfully delivering scalable web and mobile solutions. Today, he works with advanced technologies such as AI systems, RAG architectures, and modern digital solutions, while also collaborating through a strategic partnership with Technobae (UK) to build next-generation products.
