Return Value

Return Value — a value returned back to the calling code using the return statement.

public static int add(int a, int b) {
    return a + b; // Returns the sum of a and b
}

In this case, the add method returns an integer (int) as the result of the addition. If a method does not return a value, the return type is specified as void.

Related concepts

Return Value

Return Value — Structure map

Clickable & Draggable!

Return Value — Related pages: