Skip to content
Sharp

Core Java · interview question

Why is it important to avoid duplicating logic in methods when developing an e-commerce application?

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

Correct answer

D. It reduces maintenance costs and potential errors.

Why

Avoiding duplicated logic reduces maintenance costs and potential errors because changes need only be made in one place. This keeps the codebase cleaner and reduces the likelihood of inconsistencies in the application's behavior.

Test yourself on Core Java

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

Start free test
All Core Java questions →