Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. interface Silly {
  2.  
  3. public void narf();
  4.  
  5. public void poit(Silly s);
  6.  
  7. }
  8.  
  9.  
  10. public class Bird implements Silly {
  11.  
  12. public static void main(String args[]) {
  13.  
  14. System.out.println("zero");
  15.  
  16. Silly s = new SillyBird(1);
  17.  
  18. Silly s2 = new Loony();
  19.  
  20. s.poit(s2);
  21.  
  22. s2.poit(s);
  23.  
  24. System.out.println("zymurgy");
  25.  
  26. }
  27.  
  28. public Bird() {
  29.  
  30. this(0);
  31.  
  32. System.out.println("zircon");
  33.  
  34. }
  35.  
  36. public Bird(int i) {
  37.  
  38. System.out.println("zanzibar");
  39.  
  40. }
  41.  
  42. public void narf() {
  43.  
  44. System.out.println("zort");
  45.  
  46. }
  47.  
  48. public void poit(Silly s) {
  49.  
  50. s.narf();
  51.  
  52. }
  53.  
  54. }
  55.  
  56.  
  57.  
  58. class SillyBird extends Bird {
  59.  
  60. public SillyBird() {
  61.  
  62. System.out.println("duchess");
  63.  
  64. }
  65.  
  66. public SillyBird(int i) {
  67.  
  68. super(i);
  69.  
  70. }
  71.  
  72. public void narf() {
  73.  
  74. System.out.println("drum");
  75.  
  76. super.narf();
  77.  
  78. }
  79.  
  80. }
  81.  
  82.  
  83.  
  84. class Loony extends SillyBird {
  85.  
  86. public Loony() {
  87.  
  88. System.out.println("stupendous");
  89.  
  90. }
  91.  
  92. public void narf() {
  93.  
  94. System.out.println("snark");
  95.  
  96. }
  97.  
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement