Question
In Java, which comparison about Primitive Types and Wrappers is accurate?
- There is no practical difference in behavior, performance, or API design when Primitive Types and Wrappers is involved.
- Use primitives for simple values and performance-sensitive paths, and use wrappers when nullability or object semantics are required.
- The oldest option related to Primitive Types and Wrappers is always the right production choice regardless of context.
- Differences around Primitive Types and Wrappers are mostly cosmetic, so correctness and maintainability do not change.
Hint
Focus on the behavior or tradeoff, not just the keyword.
Answer and rationale
Correct answer: B. Use primitives for simple values and performance-sensitive paths, and use wrappers when nullability or object semantics are required.
Use primitives for simple values and performance-sensitive paths, and use wrappers when nullability or object semantics are required. This is the comparison that usually separates memorization from understanding.
Track: Java