Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface Duck {
- public void quack();
- public void fly();
- }
- public interface Turkey {
- public void gobble();
- public void fly();
- }
- //
- public class TurkeyAdapter implements Duck {
- Turkey turkey;
- public TurkeyAdapter(Turkey turkey) {
- this.turkey = turkey;
- }
- public void quack() {
- turkey.gobble();
- }
- public void fly() {
- for(int i=0; i < 5; i++) {
- turkey.fly();
- }
- }
- }
Add Comment
Please, Sign In to add comment