LearnFrenzy
Sign in Take a free test

Object Class and Wrapper Classes · Object and Wrapper Classes MCQ · Question 11

The range of the Integer cache Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 11 Back to Exercise

For which values does Integer.valueOf always return cached objects?

  • A 0 to 255
  • B −128 to 127 Correct
  • C −32768 to 32767
  • D All values
Correct Answer: Option B

So == between boxed Integers is unreliable outside that range.

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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links