LearnFrenzy
Sign in Take a free test

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

Long.equals with an int argument Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 17 Back to Exercise

What does Long.valueOf(5).equals(5) return?

  • A true
  • B false – 5 is boxed to Integer, and Long.equals only accepts Long Correct
  • C Compile error
  • D NullPointerException
Correct Answer: Option B

Write equals(5L).

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