The Java Program: Example.java
1
2
3
4
5
6 interface Drawable {
7 public void draw ();
8 }
9
10 interface Printable {
11 public void print ();
12 }
13
14 interface Storable {
15 public void store ();
16 }
17
18 interface Dealable {
19 public void deal ();
20 }
21
22
23
24
25
26
27
28 class Vehicle {
29 public void go () {
30
31 }
32 }
33
34 class Bicycle extends Vehicle implements Printable, Storable {
35 public void store () {
36
37 }
38
39 public void print () {
40 System.out.println ("Bicycle");
41 }
42 }
43
44
45
46
47
48
49
50
51 class Player {
52 public void play() {
53
54 }
55 }
56
57 class CardPlayer extends Player implements Dealable, Printable, Drawable {
58 public void draw () {
59
60 }
61
62 public void print () {
63 System.out.println ("CardPlayer");
64 }
65
66 public void deal () {
67
68 }
69 }
70
71
72
73
74
75
76 public class Example {
77 public static void main (String[] args) {
78
79
80 Vehicle[] v = {new Bicycle(), new Vehicle(), new Vehicle()};
81
82
83 Player[] g = {new Player(), new CardPlayer(), new Player(), new Player()};
84
85
86 Drawable[] d = {new CardPlayer(), new CardPlayer(), new CardPlayer()};
87
88
89 Printable[] p = {new Bicycle(), new CardPlayer(), new Bicycle(), new Bicycle()};
90
91
92 Storable[] s = {new Bicycle(), new Bicycle()};
93
94
95 Dealable[] r = {new CardPlayer(), new CardPlayer(), new CardPlayer()};
96 }
97 }