lundi 18 février 2019

How i can use reflection with SecurityManager to make a String + object become null

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.

    }

}

what's should i write in doSomethis() method





Aucun commentaire:

Enregistrer un commentaire