Skip to content

Commit 9c33d96

Browse files
authored
Create India.java
1 parent 5d85db5 commit 9c33d96

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

India.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
public class India {
2+
public void speaking() {
3+
System.out.println("I can speak indian languages");
4+
5+
}
6+
7+
public static void main(String[] args) {
8+
India p1= new India();
9+
India p2= new Delhi();
10+
India p3= new kerala();
11+
12+
p1.speaking();
13+
p2.speaking();
14+
p3.speaking();
15+
}
16+
17+
}
18+
class Delhi extends India{
19+
//Method Overriding
20+
public void speaking() {
21+
System.out.println("I can speak Hindi");
22+
}
23+
}
24+
25+
class kerala extends India(){
26+
public void speaking(){
27+
System.out.println("I can speak malayalam");
28+
}
29+
}
30+
31+

0 commit comments

Comments
 (0)