Javatpoint Logo
Javatpoint Logo

Java Method getGenericReturnType() Method

The getGenericReturnType() method of Method class returns a Type object that represents the formal return type of the method represented by this Method object. If the return type is a parameterized type, the Type object returned must accurately reflect the actual type parameters used in the source code.

Syntax

Parameter

No parameter is passed.

Returns

a Type object that represents the formal return type of the underlying method

Throws

GenericSignatureFormatError

TypeNotPresentException

MalformedParameterizedTypeException

Example 1

Test it Now

Output:

class java.lang.String

Example 2

Test it Now

Output:

void
Next TopicJava Method Class





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA