Java Class getGenericSuperClass() Method

The getGenericSuperClass() method of java Class class returns the Type representing the direct superclass of the class, interface, primitive type or void represented by this Class.

Syntax

Parameter

Does not take the parameter.

Returns

the direct superclass of the class represented by this object.

Throws

GenericSignatureFormatError TypeNotPresentException MalformedParameterizedTypeException

Example 1

Test it Now

Output:

java.util.ArrayList<java.lang.Integer>
class java.lang.Integer

Example 2

Test it Now

Output:

java.util.ArrayList<java.lang.Float>
class java.lang.Float
------------------------------------------------------
java.util.ArrayList<java.lang.String>
class java.lang.String

Next TopicJava Class




Latest Courses