Java Object.pdf - Java Object Class Javatpoint ADVERTISEMENT Object class in Java The Object class is the parent class of all the classes in java by

Java Object.pdf - Java Object Class Javatpoint...

This preview shows page 1 - 3 out of 5 pages.

12/2/2019 Java Object Class - Javatpoint 1/5 ADVERTISEMENT Object class in Java 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: Object obj=getObject();//we don't know what object will be returned from this method 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 class The Object class provides many methods. They are as follows: Method Description public final Class getClass() returns the Class class object of this object. The Class class can further be used to get the metadata of this class.
Image of page 1
12/2/2019
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 5 pages?

  • Fall '19
  • sumit

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors