All challenges
Multiple ChoiceBeginner 45s

Dependency injection benefit

Which is the most direct benefit of constructor injection over a global singleton lookup?
Options
  1. 1It reduces memory usage because only one shared instance of each dependency is ever created
  2. 2Explicit dependencies make the code testable and reveal coupling at the type level
  3. 3It removes the need for interfaces, since concrete classes can be passed directly to the constructor
  4. 4It guarantees thread safety by synchronizing access to every injected dependency instance

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle