Guest User

Untitled

a guest
Mar 23rd, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. public interface Duck {
  2. public void quack();
  3. public void fly();
  4. }
  5.  
  6. public interface Turkey {
  7. public void gobble();
  8. public void fly();
  9. }
  10.  
  11. //
  12. public class TurkeyAdapter implements Duck {
  13. Turkey turkey;
  14.  
  15. public TurkeyAdapter(Turkey turkey) {
  16. this.turkey = turkey;
  17. }
  18.  
  19. public void quack() {
  20. turkey.gobble();
  21. }
  22.  
  23. public void fly() {
  24. for(int i=0; i < 5; i++) {
  25. turkey.fly();
  26. }
  27. }
  28. }
Add Comment
Please, Sign In to add comment