vendredi 24 février 2017

How to determine the paramater types of a method in java?

I am trying to figure out if there is a way to check if parameter has a specific type. For example

public void foo (int a, String b){

}

How do I determine if method foo has a first parameter of type int and second String? So far I've only found how to check the types for variables but not for parameters, and I also came across generic class and stuff. Is there a easy way of doing what I am asking?

Can anyone do a quick demo on how reflection works in this case? I am very confused!





Aucun commentaire:

Enregistrer un commentaire