fork download
  1. import java.io.PrintWriter;
  2. class Ideone
  3. {
  4. public static void main (String[] args) throws java.lang.Exception
  5. {
  6. PrintWriter pw = new PrintWriter(System.out); //autoflush is disabled by default
  7.  
  8. int data1 = 5;
  9. double data2 = 100.001;
  10. String data3 = "Hello";
  11.  
  12. //use print and println just like System.out.print and System.out.println
  13. pw.print(data1);
  14. pw.println(data3);
  15. pw.println(data2);
  16.  
  17. for(int i=0; i<4; i++)
  18. pw.println(i + "*2 = " + i*2);
  19.  
  20. // remember to flush at the end
  21. pw.flush();
  22. }
  23. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
5Hello
100.001
0*2 = 0
1*2 = 2
2*2 = 4
3*2 = 6