Which statement about Integer and Double is true?
java.lang.java.util import.Integer and Double are object types that belong to java.lang, and both are immutable once created.
Explanation
A wrapper class represents a primitive value as an object, so Integer wraps an int and Double wraps a double. Immutable means the value stored inside a wrapper object cannot change after the object is created; a wrapper variable can only be reassigned to a different wrapper object. Because both classes live in java.lang, no import statement is needed to use them.
- B is not correct: These are the object forms of primitives, not primitives themselves; the primitive partners are
intanddouble. - C is not correct: The section places both classes in
java.lang, which is exactly why the code in this topic uses them with no import line at all. - D is not correct: Immutability is the point of these classes: once a wrapper object holds a value, that stored value cannot be changed.