Skip to content
Sharp

Core Java · interview question

Why should methods in Java adhere to the Single Responsibility Principle, especially in e-commerce applications?

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

Correct answer

B. To ensure each method performs only one task.

Why

The Single Responsibility Principle states that a method should perform only one task, making it easier to understand, test, and maintain.

Test yourself on Core Java

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

Start free test
All Core Java questions →