Skip to content
Sharp

Core Java · interview question

When is calculateSubtotal(...) a good method extraction?

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

Correct answer

C. When the logic has one clear job and deserves a reusable, readable name

Why

A well-named method turns a chunk of logic into an understandable operation. That makes checkout code easier to read and prepares the project for the move into richer object design later.

Test yourself on Core Java

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

Start free test
All Core Java questions →