vendredi 16 octobre 2015

Does default constructor for inner class

I was fiddling around with java, and I created two classes, Outer and Inner

public class Outer {
    public class Inner { 
    }
}

Inner class is using default constructor. I can create new instance of Inner class inside Outer just by calling non-args default constructor new Inner(). But when I tried do same thing using reflection, I noticed constructor require Outer type object.

Is that mean inner class default constructor is not non-args? Why there is disjoint between calling constructor in normal way and reflection?





Aucun commentaire:

Enregistrer un commentaire