mardi 8 août 2017

Reflection class only Initialized once

I want to use Reflection to read the display function of each child class extends class Demo.

class Demo{
    public abstract void display();
}    

I want clazz only initialized once,please help me :D

public static void getDisplay(Class<? extends Demo> clazz) throws 
                   InstantiationException, IllegalAccessException {
        return clazz.newInstance().display();
}





Aucun commentaire:

Enregistrer un commentaire