/**
* Demonstrate that it is, in fact, all too easy to access private members
* of an object using Reflection, using the default SecurityManager (so this
* will probably not work in an Applet, for example...).
*/
public class DefeatPrivacy {
public static void main(String[] args) throws Exception {
new DefeatPrivacy().process();
}

private void process() throws Exception {
Object x = new BufferedReader(new InputStreamReader(System.in));
System.out.println(x);
// System.out.println(x.p); // Won't compile
//System.out.println(x.q);
Class<?> class1 = Class.forName("java.io.BufferedReader");
Field[] flds = class1.getDeclaredFields();
for (Field f : flds) {
f.setAccessible(true); // bye-bye "private"
System.out.println(f + "==" + f.get(x));
f.setAccessible(false); // reset to "correct" state
}
}
}


java.io.BufferedReader@4554617c

private java.io.Reader java.io.BufferedReader.in==java.io.InputStreamReader@1540e19d

private char[] java.io.BufferedReader.cb==[C@677327b6

private int java.io.BufferedReader.nChars==0

private int java.io.BufferedReader.nextChar==0

private static final int java.io.BufferedReader.INVALIDATED==-2

private static final int java.io.BufferedReader.UNMARKED==-1

private int java.io.BufferedReader.markedChar==-1

private int java.io.BufferedReader.readAheadLimit==0

private boolean java.io.BufferedReader.skipLF==false

private boolean java.io.BufferedReader.markedSkipLF==false

private static int java.io.BufferedReader.defaultCharBufferSize==8192

private static int java.io.BufferedReader.defaultExpectedLineLength==80


재밌네 요거??