fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10.  
  11. static int count = 0;
  12.  
  13. Ideone(){
  14. while(count < 10){
  15. System.out.println("before: " + count);
  16. new Ideone(++count);
  17. System.out.println("after: " + count);
  18. }
  19. }
  20.  
  21. Ideone(int x){
  22. super();
  23. }
  24.  
  25. Ideone(String s){
  26. this(count);
  27. }
  28.  
  29. public static void main (String[] args) throws java.lang.Exception
  30. {
  31. new Ideone();
  32. new Ideone("Ideone");
  33. System.out.println(count);
  34. System.out.println(count++);
  35. System.out.println(count);
  36. }
  37. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
before:  0
after:  1
before:  1
after:  2
before:  2
after:  3
before:  3
after:  4
before:  4
after:  5
before:  5
after:  6
before:  6
after:  7
before:  7
after:  8
before:  8
after:  9
before:  9
after:  10
10
10
11