Java每日一题20161109

20161108问题解析请点击今日问题下方的“【Java每日一题】20161109”查看(问题解析在公众号首发,公众号ID:weknow619)

package Nov2016;

import java.lang.reflect.Method;

public class Ques1109 {

    public static void main(String[] args) throws Exception {
        String methodName = "testMethod";
        Method method01 = Test.class.getMethod(methodName);  // 1
        Method method02 = Test.class.getDeclaredMethod(methodName);  // 2
    }
    
    static class Test{
        void testMethod(){}
    }
}

今日问题:请问主程序能否正常运行?(点击以下“【Java每日一题】20161109”查看20161108问题解析)

你可能感兴趣的:(Java每日一题20161109)