Share on Google+Share on Google+

Branching Statements in java 7

Advertisement
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.

Advertisements

Posted on: December 24, 2012 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Branching Statements in java 7  

Post your Comment


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