Understanding Open/Closed Principle (OCP) from the SOLID OO principles with a Java example

Q. Is there anything wrong with the following class design? If yes, can the design be improved?

JUnit test class.

A. It’s not a good idea to try to anticipate changes in requirements ahead of time, but you…


Java Developer Interview Q&As

800+ Java Interview Q&As

Top