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. private int i = 0;
  11. public void inc() {
  12. i++;
  13. }
  14. public void println(){
  15. System.out.println(i);
  16. }
  17. public static void main (String[] args) throws java.lang.Exception
  18. {
  19. Ideone c1 = new Ideone();
  20. Ideone c2 = new Ideone();
  21. c1.println();
  22. c2.println();
  23. c2 = c1;
  24. c1.inc();
  25. c1.println();
  26. c2.println();
  27. }
  28. }
Success #stdin #stdout 0.07s 32440KB
stdin
Standard input is empty
stdout
0
0
1
1