Home » Java Object getClass() Method with Examples

Java Object getClass() Method with Examples

by Online Tutorials Library

Java Object getClass() Method

getClass() is the method of Object class. This method returns the runtime class of this object. The class object which is returned is the object that is locked by static synchronized method of the represented class.

Syntax

Returns

It returns the Class objects that represent the runtime class of this object.

Example 1

Test it Now

Output:

Class of Object obj is : java.lang.String  

Example 2

Test it Now

Output:

Class of Object obj is : java.lang.String  
Next TopicJava Object Class

You may also like