I want to remove/comment all the occurrences of System.out.println
from my java code.
This System.out.println
may be inside if
,
As Jigar Joshi said, using find & replace approach might help you a lot, especially if you don't interfere the code apart from System.out.println
.
I would propose a different solution if editing/changing the source code is not MUST for you. You can disable the System.out
stream in your driver program, then nothing will be printed by these statements. You only need to set it like this:
System.setOut(new PrintStream(new OutputStream() {
public void write(int b) {
// No operation.
}
public void close() {}
public void flush() {}
public void write(byte[] b) {}
public void write(byte[] b, int off, int len) {}
public void write(int b) {}
}));