File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Void Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Void Class" Watch "Void Class" New topic

Void Class

anil kumar bolisetti

Joined: Jan 05, 2005
Posts: 6
What is the Usage of Void Class
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

The Javadoc explains that "The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the Java keyword void.". The reflection API is a set of classes and methods that let you find out things about Java classes at runtime -- i.e., you can ask what methods a class has, what its superclass is, etc. You can also ask what a method's return type is, what its argument types are, etc.

If you ask what a method's return type is, and that method returns void, you get the static final member Void.TYPE . That is the only purpose of the Void class.

[Jess in Action][AskingGoodQuestions]
anil kumar bolisetti

Joined: Jan 05, 2005
Posts: 6
Thank you very much Ernest for the information given.
If possible can you give an example how can we use it.
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Here's a simple example. You can learn more about reflection in the Reflection Tutorial.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: Void Class
It's not a secret anymore!