It's not a secret anymore!
The moose likes Beginning Java and the fly likes The wrapper class, Void Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "The wrapper class, Void" Watch "The wrapper class, Void" New topic

The wrapper class, Void

Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

What can the wrapper class, Void, be used for? It seems to me that null would handle anything that I might want to use Void for.

-- Kaydell
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Java has the reflection API, which allows a running JVM to ask about the classes it contains, and about their methods and their fields. If you ask the reflection API what type a void method returns, it will return the static field Void.TYPE . That is the only purpose of the Void class.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: The wrapper class, Void
It's not a secret anymore!