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

I have a class


// ===========================================================
// That's the basic class for all elements

abstract class ElectricElement {

....

Then I have a few classes such as


// =========================================================

class Motor extends ElectricElement {
  // Motor

 

or


// =======================================

class Lamp extends ElectricElement {


Get class name

Now inside abstract class ElectricElement I can get the classes like “Lamp” with getClass().toString()

(and that does not really help you)

1 Like