Use System.err.println() instead.
Why?
System.out.println() often redirected to a file or other output, while it is often printed to the console. This is easier to debug, and also the right way to do it.
Edit (warning: subjective):
Since you asked whether System.out.println should be completely excluded: I don’t believe in anything that you should always avoid, whether using goto, crashing your computer with BSOD or something else, sometimes you just need to a quick and dirty way to quickly do small things, and it’s just not worth the 1 hour you spend on it to try to do something the “right” way, and not a 5-minute fix, no matter how good the “good” one is Method: Use your opinion when deciding whether to use something or not, but no yes no set rules for yourself, like "I'll never use a goto!". :)
Change 2 (example):
Say you are debugging a crash driver and you suspect that an if being executed that should not be executed. Instead of spending three hours on how to use ZwRaiseHardError to display a message box, just call KeBugCheck inside the if and trigger the black system. Of course, you will reboot, but if your reboot does not take many hours, you just saved yourself so much time.
source share