Java Class isPrimitive() Method

The isPrimitive() method of java Class class checks if the specified Class object represents a primitive type.

Syntax

Parameter

NA

Returns

true if and only if this class represents a primitive type.

Throws

NA

Example 1

Test it Now

Output:

true
false
false

Example 2

Test it Now

Output:

obj is primitive type? = false
k is primitive type? = true

Next TopicJava Class




Latest Courses