Sobes.tech
Junior — Middle

Which principle of SOLID is not applied to classes declared with the final modifier?

sobes.tech AI

Answer from AI

The SOLID principle that does not apply to classes with the final modifier is the Open/Closed Principle (OCP).

This principle states that classes should be open for extension but closed for modification. However, if a class is declared as final in Java, it cannot be inherited or extended, which limits the ability to extend.

Other SOLID principles (Single Responsibility, Liskov Substitution, Interface Segregation, Dependency Inversion) are applicable to final classes without restrictions.