I want to format the output of my java program so that whenever it’s redirected to a file (xl or csv file) I want the output to be comma separated, but when displayed on console it should not be comma separated. These should be at runtime.
Share
From Java 6 onwards we have the Console class. It’s instance can be obtained by System.console() method. If no console device is available at runtime then invocation of this method will return null.