Consider this example :
import java.lang.reflect.Field;
public class Test {
public static void main(String[] args) {
C c = new C();
try
Both getDeclaredField() and setAccessible() are actually checked by the security manager and will throw an exception when your code is not allowed to do this. More often than not you won't notice it, because Java code is often run without a security manager.
One important exception are Applets, which always run with a security manager.