return Java Keyword

The return keyword causes a method to return to the method that called it, passing a value that matches the return type of the returning method.

Examples

  public void myVoidMethod()
  {
     <statements>
     return;
  }
  
  public String myStringMethod()
  {
     String s = "my response";
     return s;
  }
  
  public int myIntMethod()
  {
     int i = 5;
     return(i);
  }
  

Remarks

Related Topics

None.