As we all know, Java reflection provides Class.getConstructors
method, but how is the order of the Constructor<?>[]
array?
For example, I create Person class and there are 3 construct method:
public Person()
{
}
public Person(int age)
{
this.age = age;
}
public Person(int age, String name)
{
this.age = age;
this.name = name;
}
And by debug, I find the order of constructor array like this:
0 = public xxx.Person(int)
1 = public xxx.Person(int, java.lang.String)
2 = public xxx.Person()
Aucun commentaire:
Enregistrer un commentaire