Java Class isInstance() Method

The isInstance() method of java Class class checks if the specified object can be assigned to object represented by that class, i.e., if both the objects are an instance of the same class or not.

Syntax

Parameter

obj - the object to check

Returns

true if obj is an instance of this class.

Throws

NA

Example 1

Test it Now

Output:

true
true

Example 2

Test it Now

Output:

998765 is Long ? true

Next TopicJava Class




Latest Courses