fork download
  1. // 21-abril-2017
  2.  
  3. class Echo // +
  4. {
  5. int count = 0; // +
  6.  
  7. void hello(){ // +
  8. System.out.println("helloooo... ");
  9. }
  10.  
  11. public static void main(String[] args)
  12. {
  13. Echo e1 = new Echo();
  14. Echo e2 = new Echo(); // +
  15. // Echo e2 = e1; // es la respuesta bonus
  16.  
  17. int x = 0;
  18. while( x < 4) //+
  19. {
  20. e1.hello();
  21. e1.count = e1.count + 1;// +
  22. if( x == 3) {e2.count = e2.count + 1; } // +
  23. if( x > 0) {e2.count = e2.count + e1.count; } // +
  24. x = x + 1;
  25. }
  26.  
  27. System.out.println(e2.count);
  28. System.out.println("");
  29. }
  30.  
  31. }
  32.  
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
helloooo... 
helloooo... 
helloooo... 
helloooo... 
10