I have the following,
public interface SuperbInterface
public class A implements SuperbInterface
public class B extends A
public class C extends B
I want to instantiate C but I seems to be getting B, what did I do wrong?
Class classz = Class.forName("C");
SuperbInterface superb = (SuperbInterface)classz.newInstance();
//Here when I debug it seems to be going to B.doWork() methods instead of C.doWork().
superb.doWork();
The only thing I can think of is that you haven’t overridden doWork() in C.
Maybe you have tried ot override but with some spelling mistake in method name or wrong parameters?