File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ class Teachers extends PersonInheritance {
2+
3+ }
4+ class Students extends PersonInheritance {
5+
6+ }
7+ class Staffs extends PersonInheritance {
8+
9+ }
10+
11+
12+ public class PersonInheritance {
13+ String name ;
14+ int phone ;
15+
16+ public void showaddress () {
17+ System .out .println ("Name: " +name );
18+ System .out .println ("Phone: " +phone );
19+ }
20+
21+
22+ public static void main (String [] args ) {
23+ PersonInheritance t1 =new PersonInheritance ();
24+ t1 .name ="Aliya" ;
25+ t1 .phone =123 ;
26+ t1 .showaddress ();
27+
28+ Teachers t2 = new Teachers ();
29+ t2 .name ="abid" ;
30+ t2 .phone =456 ;
31+ t2 .showaddress ();
32+
33+ Staffs s1 = new Staffs ();
34+ s1 .name ="goutham kk" ;
35+ s1 .phone =789 ;
36+ s1 .showaddress ();
37+
38+ Students s2 =new Students ();
39+ s2 .name ="rishiiiii" ;
40+ s2 .phone =123 ;
41+ s2 .showaddress ();
42+ }
43+
44+ }
You can’t perform that action at this time.
0 commit comments