Why does .getConstructor fail with a NoSuchMethodException despite zero-arg constructors existing for the class?

Although reflection/introspection is a powerful workaround tool, we should avoid abusing it.

You could easily replace newInstance() w/ a switch/case block, where each “className” has a corresponding return new className();.

2 Likes