Our social:

Wednesday, October 5, 2016

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.
public class ReturnDemo {
 public static void main(String[] args) {
 public static int returnValue()
  int i = 0;
  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


Post a Comment

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