LearnFrenzy
Sign in Take a free test

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

Creating a BigDecimal correctly Answer, explanation & discussion

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

Which creates exactly 0.1?

  • A new BigDecimal(0.1)
  • B new BigDecimal("0.1") Correct
  • C BigDecimal.valueOf(0.1f)
  • D new BigDecimal(1 / 10)
Correct Answer: Option B

new BigDecimal(0.1) captures the binary approximation 0.1000000000000000055511…

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