-
Notifications
You must be signed in to change notification settings - Fork 137
/
Solution.java
43 lines (36 loc) · 775 Bytes
/
Solution.java
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
43
abstract class State {
public abstract Flower yourNationalFlower();
}
class WestBengal extends State {
public Jasmine yourNationalFlower() {
return new Jasmine();
}
}
class Karnataka extends State {
public Lotus yourNationalFlower() {
return new Lotus();
}
}
class AndhraPradesh extends State {
public Lily yourNationalFlower() {
return new Lily();
}
}
abstract class Flower {
public abstract String whatsYourName();
}
class Jasmine extends Flower {
public String whatsYourName() {
return "Jasmine";
}
}
class Lily extends Flower {
public String whatsYourName() {
return "Lily";
}
}
class Lotus extends Flower {
public String whatsYourName() {
return "Lotus";
}
}