Java Class getComponentType() Method

The getComponentType() method of java Class returns the class representing the component type of an array. Otherwise this method return null.

Syntax

Parameter

NA

Returns

Class representing the component type.

Throws

This does not throw an exception.

Example 1

Test it Now

Output:

The componentType = java.lang.String

Example 2

Test it Now

Output:

int
class java.lang.String
class java.lang.Void
null

Next TopicJava Class




Latest Courses