3 ms·
Well, they're a lot longer to type, but you can use [1] to get a method (and handle the error to see if it exists) and [2] to call the method on a given object.
by koenigdavidmj 14y ago
Well, they're a lot longer to type, but you can use [1] to get a method (and handle the error to see if it exists) and [2] to call the method on a given object.
1: http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Class.html#getMethod%28java.lang.String,%20java.lang.Class...%29 http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Class...
2: http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/reflect/Method.html#invoke%28java.lang.Object,%20java.lang.Object...%29 http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/refle...