太难了!
public MyClass() { System.setOut(new PrintStream(new FilterOutputStream(System.out) { @Override public void write(byte[] b, int off, int len) throws IOException { if(new String(b).contains("true")) { byte[] text = "false".getBytes(); super.write(text, 0, text.length); } else { super.write(b, off, len); } } }, true));}或Paul Boddington的简化版本:
PrintStream p = System.out; System.setOut(new PrintStream(p) { @Override public void println(boolean b) { p.println(false); }});或是AJ Neufeld的更简单建议:
System.setOut(new PrintStream(System.out) { @Override public void println(boolean b) { super.println(false); }});


