wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes void Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "void" Watch "void" New topic
Author

void

lusha tak
Ranch Hand

Joined: Dec 30, 2000
Posts: 185
I couldn't undersatnd why do we consider void as a primitive type and what we go to do with the Wrapper class Void ???
please explain
Regards
Lusha
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Lusha,
According to the API documentation:

The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the Java keyword void.

What that means is that you don't do anything with it! Since it can't be instantiated (private constructor) you can't use it. Since it is final you can't override it. Therefore, it only exists to provide a placeholder for the class type holding the void variable.
Regards,
Manfred.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
The keyword "void" is NOT a primitive type. In the Java language, there are only 8 primitive types: boolean, byte, char, short, int, long, double, and float. Only these primitive types have a corresponding wrapper class; these are Boolean, Byte, Character, Short, Integer, Long, Double, and Float, respectively.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
I think the Void class is used for reflection.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: void
 
Similar Threads
Method signature
static
unreachable code...
Where would the return from main go to?
What is the difference between null and void?