Open In App

Java.lang.Void Class in Java

Improve
Improve
Like Article
Like
Save
Share
Report

Java.lang.Void class is a placeholder that holds a reference to a class object if it represents a void keyword. It is an uninstantiable placeholder. Well, uninstantiable means that this class has a private constructor and no other constructor that we can access from outside. 

Methods of lang.void class is all inherited from Object class in Java:

  • getClass(): Returns the runtime class of the argument Object.
  • hashCode(): Returns a hash code value for the object.
  • equals(): Checks whether the two objects are equal or not.
  • clone(): Returns a copy of the object.
  • toString(): Returns string representation of the object.
  • notify(): Wakes up a single thread that is waiting on this object’s monitor.
  • notifyAll(): Wakes up all threads that is waiting on this object’s monitor.
  • wait(): Makes current thread to wait until previous thread invokes either notify() or notifyAll() methods.
  • finalize(): Called By the garbage collector on an object when garbage collection determines that there are no more references to the object.

Reference: 

Java Oracle docs

   


Last Updated : 13 Sep, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads