Skip to content
Sharp

Core Java · interview question

Which of the following is the correct way to subtract one BigDecimal from another?

Multiple choiceMediumchapter-7-curatedpremiumcore-javabigdecimal-and-money
Choose one answer
Answer and explanation

Correct answer

D. Value1.subtract(value2)

Why

The subtract method on a BigDecimal instance is used to subtract one BigDecimal from another. This method ensures accurate arithmetic operations, avoiding the pitfalls of using operators like - for BigDecimal objects.

Test yourself on Core Java

A free test with instant, explained results. No account needed.

Start free test
All Core Java questions →