Javatpoint Logo
Javatpoint Logo

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





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