Which of these method of object class is used to obtain class of an object at run time?
next → ← prev Show The Object class is the parent class of all the classes in java by default. In other words, it is the topmost class of java. The Object class is beneficial if you want to refer any object whose type you don't know. Notice that parent class reference variable can refer the child class object, know as upcasting. Let's take an example, there is getObject() method that returns an object but it can be of any type like Employee,Student etc, we can use Object class reference to refer that object. For example: The Object class provides some common behaviors to all the objects such as object can be compared, object can be cloned, object can be notified etc. Methods of Object classThe Object class provides many methods. They are as follows:
We will have the detailed learning of these methods in next chapters. Next TopicObject Cloning in java ← prev next → For Videos Join Our Youtube Channel: Join Now Feedback
Help Others, Please Share The Object class. The Object class defines the basic state and behavior that all objects must have, such as the ability to compare oneself to another object, to convert to a string, to wait on a condition variable, to notify other objects that a condition variable has changed, and to return the object's class. The |