Question 10
Back to Exercise
What does the compiler turn Integer x = 42; into?
- A new Integer(42)
- B Integer.valueOf(42) Correct
- C Integer.parseInt("42")
- D (Integer) 42.0
Correct Answer: Option B
valueOf may return a cached object; new Integer is deprecated for removal.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!