我如何在SecurityManager中使用反射使String + Object变为null

时间:2019-02-18 15:38:57

标签: java reflection

public class Test {
    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        System.setSecurityManager(new SecurityManager(){
            @Override
            public void checkPermission(Permission perm) {
            }
        });
        doSomething();
        System.out.println("if success" + System.getSecurityManager()==null);
    }
    public static void doSomething() throws NoSuchFieldException, IllegalAccessException {
        //use reflection
        //Only allow answers within this method, so that the final output of 
        //the main method is true.
    }
}

我应该用doSomethis()方法写什么?

0 个答案:

没有答案