Question 3
Back to Exercise
The program below does not compile. Which statement correctly describes the problem?
public class Main {
public static void main(String[] args) {
Integer users = 5000L;
System.out.println(users);
}
}
- A 5000 is too large
- B Boxing converts a long only to Long, never to Integer; use 5000 or declare Long Correct
- C Integer must be initialised with new
- D L must be lower case
Correct Answer: Option B
Autoboxing does not combine with narrowing conversions.
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!