Suppose we a have class named DynamicClass
:
public class DynamicClass {
public void get(String input) {
System.out.println(input);
}
}
Now, imagine the following instantiating of DynamicClass
:
DynamicClass clazz = new DynamicClass();
clazz.getName();
clazz.getOther();
Of course, the calling of getName
and getOther
methods throws MethodNotFoundException
exception. However, I'm curious, is there any way in java to catch the MethodNotFoundException
exception inside the DynamicClass
class, i.e. the calling of get("Name")
and get("Other")
rather than throwing the MethodNotFoundException
exception due to the calling of getName()
and getOther()
?
Aucun commentaire:
Enregistrer un commentaire