Object class in Java

The java.lang.Object acts as a super class of every java class by default. Directly or indirectly every class is inheriting from java.lang.Object class. This class is having few methods.If needed we can override the methods in our class , or even we can use the default implementation.

The methods are :

1) getClass()  :- This method returns the run time class of a particular object.

See an example for getClass()

2)finalize() : – It is invoking by the garbage collector.

3)toString() :- Giving the string representation of a particular object.

See more about toString()

4)clone() :- Returning  copy of a particular object.

See more about clone() and example

5)hashCode() :- Returns the hash code (An integer value) for an object.

6)equals() :- Checks whether two objects are equals or not.

See more about hashCode() & equals()

7)wait () :-Using to synchronize multiple threads

8)notify() :-It is also using to synchronize multiple threads

9)notifyAll() :- It is also using to synchronize multiple threads

See more about  wait() , notify() and notifyAll()

6 thoughts on “Object class in Java

  1. Louis Reply

    Thanks a lot for sharing this with all people you actually know what you are speaking about! Bookmarked. Kindly also discuss with my website =). We will have a hyperlink alternate agreement among us!

  2. Louis Reply

    Good website! I really love how it is easy on my eyes and the data are well written. I’m wondering how I might be notified whenever a new post has been made. I’ve subscribed to your RSS which must do the trick! Have a nice day!

  3. feezor Reply

    It’s hard to come by knowledgeable people in this particular topic, however, you seem like you know what you’re talking about! Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *