Wednesday, October 5, 2016

Muhammad Akbar

Return Statement in Java-Tutorial

While discussing about methods we have already encountered return statement. This statement is used to manually return a control from a method to the actual workflow. In a method, whenever the workflow meets a return statement, it returns the workflow from there without executing any more statements in that method.
Example:
public class ReturnDemo {
 public static void main(String[] args) {
  
  System.out.println(returnValue());
 }
 
 public static int returnValue()
 {
  int i = 0;
  i++;
  return i;  
 }
}
Try It

Unreachable Code Error

Any statement written after the return statement will give you an error while compiling. This is because compiler is telling you that you have written return from where your workflow will break and the code after return is not accessible and unreachable.

         

  Java Multithreading

Muhammad Akbar

About Muhammad Akbar -

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :

Hello Every One thanks For Visit My site You Can Suggest any Idea About site And Related Education Information Provide me Its Best Content For you am Include in this Site And feel free contact And email now I hope This site very help full you