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()