Skip to content
Related Articles
Open in App
Not now

Related Articles

Java.lang.Void Class in Java

Improve Article
Save Article
Like Article
  • Difficulty Level : Basic
  • Last Updated : 14 Jun, 2022
Improve Article
Save Article
Like Article

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

 This article is contributed by Mohit Gupta. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks. 

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!