import java.io.*; public class A { public static void main(String[] args) throws Exception { BufferedOutputStream bos = new BufferedOutputStream(System.out); PrintStream ps = new PrintStream(bos); System.out.println("1"); ps.println("2"); System.out.println("3"); ps.flush(); } } ### c:\desktop> javac *.java && java A 1 3 2 Process javac exited with code 0