-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinter.java
More file actions
42 lines (32 loc) · 875 Bytes
/
Copy pathinter.java
File metadata and controls
42 lines (32 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
interface Playable {
void play();
}
class Football implements Playable {
@Override
public void play() {
System.out.println("Let's Play Football: Kicking the ball and scoring goals.");
}
}
class Volleyball implements Playable {
@Override
public void play() {
System.out.println("Let's Play Volleyball: Serving and spiking the ball over the net.");
}
}
class Basketball implements Playable {
@Override
public void play() {
System.out.println("Let's Play Basketball: Dribbling and shooting hoops.");
}
}
public class inter {
public static void main(String[] args) {
Playable football = new Football();
Playable volleyball = new Volleyball();
Playable basketball = new Basketball();
System.out.println("Sports Activities:");
football.play();
volleyball.play();
basketball.play();
}
}