Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface Silly {
- public void narf();
- public void poit(Silly s);
- }
- public class Bird implements Silly {
- public static void main(String args[]) {
- System.out.println("zero");
- Silly s = new SillyBird(1);
- Silly s2 = new Loony();
- s.poit(s2);
- s2.poit(s);
- System.out.println("zymurgy");
- }
- public Bird() {
- this(0);
- System.out.println("zircon");
- }
- public Bird(int i) {
- System.out.println("zanzibar");
- }
- public void narf() {
- System.out.println("zort");
- }
- public void poit(Silly s) {
- s.narf();
- }
- }
- class SillyBird extends Bird {
- public SillyBird() {
- System.out.println("duchess");
- }
- public SillyBird(int i) {
- super(i);
- }
- public void narf() {
- System.out.println("drum");
- super.narf();
- }
- }
- class Loony extends SillyBird {
- public Loony() {
- System.out.println("stupendous");
- }
- public void narf() {
- System.out.println("snark");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement