Home Java Jdk7 Branching Statements in java 7



Branching Statements in java 7
Posted on: December 24, 2012 at 12:00 AM
In this section, we will discuss about Branching Statements in java 7. This is one type of control flow statement.

Branching Statements in java 7

In this section, we will discuss about Branching Statements in java 7. This is one type of control flow statement.

Branching Statements :

Branching statements are categorize in the following types :

  • break statement
  • continue statement
  • return statement

Break Statement :

The functionality of break statement is to break the flow of your loop (do-while, while, for or switch statement). In switch statement we use break at the end of each case statement.

Syntax :

loop (...){
condition{
break;
}
......//statements
}

Continue Statement :

Continue statement is another branching statement provided by the java 7. Its functionality to stop the current iteration of the specified loop and continue execution with the next iteration.

Syntax :

loop (...){
condition{
continue;
}
......//statements
}

Return Statement :

It is another branching statement. The functionality of return statement is to exits the current method and it returns the flow of your control to the method is called.

return;

 You can also return some value by using the return statement.

return result;

Condition is that the data type of return value and the return type of method must be same.

Related Tags for Branching Statements in java 7:


More Tutorials from this section

Ask Questions?    Discuss: Branching Statements in java 7  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.