Namrata Maheshwari wrote:1) If I use -> System.out.println("Message");
SystemUtil.flushOutput();
Will this flush System.out ?
Only if ystemUtil.out() has been called before and afterwards nobody called System.setOut to change System.out.
You can flush System.out each time by changing SystemUtil.flushOutput() to call out().flush(). The call to out() will initialize OUT if it's null.
2)How System.out.println is different from SystemUtil.out.println
SystemUtil.out.println() will not compile; you mean SystemUtil.out().println. As far as I know System.out uses the default encoding which should be the same as System.getProperty("file.encoding").