This question already has an answer here:
I have this class:
public final class MyObject{
}
Whats the difference between calling:
new MyObject();
MyObject.class.newInstance();
And does #2 use reflection?
Note: I have seen similar posts, but they all used Class.forName("...").newInstance()
which is a whole other story.
Aucun commentaire:
Enregistrer un commentaire