Return type
|
In computer programming, the Return type constrains the resulting value from calling a method or function. It must be explicitly mentioned when declaring a function in many of the high-level programming languages, such as Java, C++, C and many others.
A Java example could be:
public int someMethod()
In this example, the return type is int. This means that when that method is completed, it will return a value of type int.
In Java, the return type can be any object or interface type, or any of the primitive types. An example of a Java object type is java.lang.String, whereas char is a primitive Java type.