o*****l 发帖数: 539 | 1 In the following example,
I can get method "setStr" correctly.
Please help me to correctly set the parameters in getDeclaredMethod() to get
method "setStr2" method successfully.
Thanks
public class PrivateTest {
private String str = "hello";
private void setStr(String a)
{
str = a;
}
private void setStr2(String[] a)
{
str = a[0];
}
}
public class DemoTest {
public static void main(String[] args)
{
Class clazz = PrivateTest.class;
Method method = clazz.getDeclaredMethod("setStr", new Class[] {
String.class});
Method method = clazz.getDeclaredMethod("setStr2", new Class[] {
?????});
}
} | F****n 发帖数: 3271 | 2 String[].class
get
【在 o*****l 的大作中提到】 : In the following example, : I can get method "setStr" correctly. : Please help me to correctly set the parameters in getDeclaredMethod() to get : method "setStr2" method successfully. : Thanks : public class PrivateTest { : private String str = "hello"; : private void setStr(String a) : { : str = a;
| o*****l 发帖数: 539 | 3 Thanks!
【在 F****n 的大作中提到】 : String[].class : : get
|
|