A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

public class TestClass {
   private static void testMethod(){
        System.out.println("testMethod");
   }
   public static void main(String[] args) {
        ((TestClass)null).testMethod();
   }
}
A编译不通过
B编译通过,运行异常,报NullPointerException
C编译通过,运行异常,报IllegalArgumentException
D编译通过,运行异常,报NoSuchMethodException
E编译通过,运行异常,报Exception
F运行正常,输出testMethod
答案是什么,为什么呢

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马