Advertisement
Biodoom

Funny af

Jul 5th, 2015
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. package chapter7;
  2. class Cleanser{
  3. private String s = "Cleanser";
  4. public void append(String a){ s+=a;}
  5. public void dilute(){append(" dilute");}
  6. public void apply(){append(" apply");}
  7. public void scrub(){append(" scrub");}
  8. public String toString(){return s;}
  9. public static void main(String[] args)
  10. {
  11. Cleanser x = new Cleanser();
  12. x.dilute(); x.apply();x.scrub();System.out.println(x);
  13. }
  14. }
  15. public class Detergent extends Cleanser{
  16. public void scrub(){
  17. append(" Detergent.scrub");
  18. super.scrub();
  19. }
  20. public void foam(){
  21. append(" foam");
  22. }
  23. public static void main(String[] args)
  24. {
  25. Detergent x = new Detergent();
  26. x.dilute();
  27. x.apply();
  28. x.scrub();
  29. x.foam();
  30. System.out.println(x);
  31. System.out.println("Test klasy bazowaej");
  32. Cleanser.main(args);
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement