Java.lang.Object Class
Java Object Class
The Object class in the Java.lang package, i.e Java.lang.Object is the root of the class hierarchy. Object is the superclass of all classes. This class’s methods are implemented by all objects, including arrays.
Class declaration
The declaration of Java.lang.Number class is:
public class Object
Class Constructor
S.N | Constructors & Description |
---|---|
1. | Object() |
Java.lang.Object Methods
The java.lang.Object class has a number of methods which are listed below:
Member Methods
S.N | Methods & Description |
---|---|
1. | protected Object clone() Creates and returns a copy of this object. |
2. | boolean equals(Object obj) Indicates whether some other object is “equal to” this one. |
3. | protected void finalize() Deprecated. When trash collection concludes that there are no more references to an object, the garbage collector calls this method. |
4. | Class<?> getClass() Returns the runtime class of this Object. |
5. | int hashCode() Returns a hash code value for the object. |
6. | String toString() Returns a string representation of the object. |
To open the online compiler click here.