samedi 3 décembre 2016

Why do Constructors, unlike Methods, do not retain the name of their parameters in Java?

In Java, when using reflection you can access the name of each parameters of a Method using the following code:

Parameter[] parameters = method.getParameters();
String parameterName = parameter[<index of desired parameter>].getName();

However, doing so is impossible using the standard reflection API for Constructors. Why so?





Aucun commentaire:

Enregistrer un commentaire