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