What is Methods In Object Class In Java?
In Java, the Object class provides several key methods that are fundamental to all objects. These include:
toString()
: Returns a string representation of the object.equals(Object obj)
: Compares two objects for equality.hashCode()
: Returns a hash code value for the object.getClass()
: Returns the runtime class of the object.clone()
: Creates and returns a copy of the object (if supported).notify()
,notifyAll()
,wait()
: Used for thread synchronization.
These methods can be overridden to provide custom behavior as needed.