我正在尝试实现这个解决方案,以临时禁用一个不良库的输出。但我的问题是我遇到了这个:
The constructor PrintStream(new OutputStream(){}) is undefined
使用此代码
PrintStream out = System.out;
System.setOut(new PrintStream(new OutputStream() {
public void write(int b) throws IOException {}
}));
这个类怎么没有构造函数呢?谢谢。
public void write()
上面添加@Override
。 - musical_coder