Skip to content
Sharp

Core Java · interview question

Consider the method signature: double calculateDiscount(double price, double discountRate). What does this method do?

Multiple choiceMediumchapter-1-curatedpremiumcore-javamethods
Choose one answer
Answer and explanation

Correct answer

B. It returns a double representing the discount amount.

Why

The method returns a double, indicating that it calculates and returns the discount amount, not the final price.

Test yourself on Core Java

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

Start free test
All Core Java questions →