java method returns number code example
Example 1: how to create a function that returns in java
// a method for computing the area of the rectangle
public int getArea() {
return width * height;
}
Example 2: return statement in java
A return statement causes the program control to transfer back to the caller of a method.