Guest User

Untitled

a guest
Jul 12th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. class Echo2 {
  2. int count = 0;
  3. void hello(){
  4. System.out.println("helloooo...");
  5. }
  6. }
  7.  
  8. public class Echo1 {
  9. public static void main (String[] args) {
  10. Echo2 e1 = new Echo2();
  11. Echo2 e2 = new Echo2();
  12.  
  13. int x = 0;
  14. while (x<4) {
  15. e1.hello();
  16. if (x>0) {
  17. e2.count=e2.count+e1.count;
  18. }
  19. e1.count = e1.count + 1;
  20. if (x == 3) {
  21. e2.count = e2.count + 1;
  22. }
  23. x=x+1;
  24. }
  25. System.out.println(e2.count);
  26. }
  27. }
Add Comment
Please, Sign In to add comment