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()
方法写什么?