private void setI(int i) { this.i = i; }
Sending Integer.class in argument list cause throwing an exception: java.lang.NoSuchMethodException:
The correct way is this:
Method iMethod = progClass.getDeclaredMethod( "setI", new Class[]{ Integer.TYPE } );
Same pattern could be applied for byte, short, long, float, double, boolean, char.
No comments:
Post a Comment