lundi 5 février 2018

How to use an instance of Class as a generic type?

I would like to do something like this in java 8:

public void example(Class clazz) {
    MyClass<clazz> myObj = new MyClass<clazz>();
}

But I'm getting "cannot find symbol: symbol class clazz location: "

Is this possible? Thanks!





Aucun commentaire:

Enregistrer un commentaire