根据方法名获取方法的值,类中出现了重载,怎么办
Method getMethod = c.getMethod(getMethodName); 
我要是有两个相同名称,不同返回值的类型不同,这时候根据方法名获取的方法,就有两个方法了啊,就是说类中出现了重载,怎么办?
Method getMethod = c.getMethod(getMethodName); 
我要是有两个相同名称,不同返回值的类型不同,这时候根据方法名获取的方法,就有两个方法了啊,就是说类中出现了重载,怎么办?
 
                            2016-05-30
    public transient Method getMethod(String s, Class aclass[])
        throws NoSuchMethodException, SecurityException
    {
        checkMemberAccess(0, Reflection.getCallerClass(), true);
        Method method = getMethod0(s, aclass);
        if(method == null)
            throw new NoSuchMethodException((new StringBuilder()).append(getName()).append(".").append(s).append(argumentTypesToString(aclass)).toString());
        else
            return method;
    }哦,看了一下getMethod方法,才知道,后面可以跟参数列表类型
举报