mercredi 11 mars 2015

Why getmethod returns null even though the method exists

I have the following code:



String methodName = "main";
Method[] methods = classHandle.getMethods();
for (Method m : methods)
{
System.out.println(m.getName().equals(methodName);
}
Method classMethod = null;
try
{
classMethod = classHandle.getMethod(methodName);
}
catch(Exception e)
{

}
System.out.println(classMethod == null);


The first print prints true, but the second one also prints true.


Why is that happening?






Aucun commentaire:

Enregistrer un commentaire