Java.lang.Void class is a placeholder which holds a reference to a class object if it represents void keyword. It is a uninstantiable placeholder. Well, uninstantiable means that this class have a private constructor and no other constructor that we can access from outside.
Methods of lang.void class are all inherited from Object class in Java:
- getClass() : Returns the runtime class of the argumented Object.
- hashCode() : Returns a hash code value for the object.
- equals() : Checks whether the two objects are equal or nor.
- 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.
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 contribute.geeksforgeeks.org or mail your article to email@example.com. 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.
- Implement Pair Class with Unit Class in Java using JavaTuples
- Implement Triplet Class with Pair Class in Java using JavaTuples
- Implement Decade Class from Ennead Class in Java using JavaTuples
- Implement Ennead Class from Octet Class in Java using JavaTuples
- Implement Sextet Class from Quintet Class in Java using JavaTuples
- Implement Octet Class from Septet Class in Java using JavaTuples
- Implement Quartet Class with Triplet Class in Java using JavaTuples
- Implement Quintet Class with Quartet Class in Java using JavaTuples
- Implement Septet Class from Sextet Class in Java using JavaTuples
- In Java, Can we call the main() method of a class from another class?
- Difference between Abstract Class and Concrete Class in Java
- Using predefined class name as Class or Variable name in Java
- Java.lang.Class class in Java | Set 1
- Java.lang.Class class in Java | Set 2
- Java.util.concurrent.RecursiveAction class in Java with Examples