-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.java
More file actions
31 lines (31 loc) · 712 Bytes
/
app.java
File metadata and controls
31 lines (31 loc) · 712 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
public class LogisticsApp {
public static void main(String[] args) {
Transport t;
t = new Truck();
t.deliver();
t = new Ship();
t.deliver();
t = new Airplane();
t.deliver();
}
}
class Transport {
void deliver() {
System.out.println("Transport is delivering goods");
}
}
class Truck extends Transport {
void deliver() {
System.out.println("Truck is delivering goods");
}
}
class Ship extends Transport {
void deliver() {
System.out.println("Ship is delivering goods");
}
}
class Airplane extends Transport {
void deliver() {
System.out.println("Airplane is delivering goods");
}
}