Crenox

Echo Program

Jan 19th, 2014
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. package samkough.main;
  2.  
  3. public class Echo
  4. {
  5. public static void main(String args[])
  6. {
  7. EchoTestDrive e1 = new EchoTestDrive();
  8. EchoTestDrive e2 = new EchoTestDrive();
  9.  
  10. int x = 0;
  11. while(x < 4)
  12. {
  13. e1.hello();
  14. e1.count = e1.count + 1;
  15.  
  16. if(x == 4)
  17. {
  18. e2.count = e2.count + 1;
  19. }
  20.  
  21. if(x < 4)
  22. {
  23. e2.count = e2.count + e1.count;
  24. }
  25.  
  26. x = x + 1;
  27. }
  28.  
  29. System.out.println(e2.count);
  30. }
  31. }
  32.  
  33. ------------------------------------------------------------------------------------------------------------------
  34. package samkough.main;
  35.  
  36. public class EchoTestDrive
  37. {
  38. int count = 0;
  39. void hello()
  40. {
  41. System.out.println("helloooo... ");
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment