mercredi 17 février 2016

Create instance of a Class type using newInstance()

So I'm trying to create an instance of a class using following statements (simplified):

class A
classOf[A].newInstance()

The call throws:

java.lang.InstantiationException: A$A426$A$A426$A
Caused by: java.lang.NoSuchMethodException: A$A426$A$A426$A.<init>()

I did try defining init() method with different variations with no success. What am I missing?

Thanks in advance.


Related, didn't work for me:

No such method exception Hadoop <init>

This answer





Aucun commentaire:

Enregistrer un commentaire