屏蔽控制台中有system.out输出的内容时可以使用一下方式进行屏蔽
1. 打印流PrintSteam重定向输出端System.setOut();
在启动方法main内加入如下代码
public class Main {
public static void main(String[] args) {
System.setOut(new PrintStream(new OutputStream() {
@Override
public void write(int b) throws IOException {
}
}));
sayhello();
}
private static void sayhello() {
System.out.println("hello sout");
}
}