wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes java.lang.Void wrapper class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "java.lang.Void wrapper class" Watch "java.lang.Void wrapper class" New topic
Author

java.lang.Void wrapper class

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2581

JQPlus Question ID :955326363480
Which of the following are wrapper classes for primitive types?
(Choose 1)
Options
a) String
b) Void
c) null
d) Object
e) None of the above

Answer and Explanation
e) None of the above
Frequently it is necessary to represent a value of primitive type as if it were an object. There are following wrapper classes for this purpose:
Boolean, Byte, Character, Short, Integer, Long, Float, and Double .
Note that Byte, Short, Integer, Long, Float and Double extend from Number which is an abstract class. An object of type Double, for example, contains a field whose type is double, representing that value in such a way that a reference to it can be stored in a variable of reference type. These classes also provide a number of methods for converting among primitive values, as well as supporting such standard methods as equals and hashCode.
Doubts
But in the Java API (I have 1.2 API), it is given that - The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the primitive Java type void. What's is the right answer?
TIA,
- Manish
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
this is what we call a doc bug. void is not a primitive type. Refer to this discussion where we discussed that issue some time ago.
http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=24&t=013732


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
HTH :)


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2581

It does help
Thanks a ton, both of you.
It seems the API documentation also has quite a few bugs, I managed to find a few in IO as well
Ravish, I like ur signature, though never noticed it before, I have been following it, believe me on this one
Thanks,
- Manish
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Originally posted by Manish Hatwalne:
I have been following it, believe me on this one

Thats why you like it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.Void wrapper class