-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudentExp.java
More file actions
56 lines (43 loc) · 961 Bytes
/
studentExp.java
File metadata and controls
56 lines (43 loc) · 961 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
43
44
45
46
47
48
49
50
51
52
53
54
public class studentExp
{
public static void main(String args[])
{
State Kerala = new State("India", "Modi", "Kerala", "Pinarayi Vijayan");
State Islamabad = new State("Pakistan", "someone", "Islamabad", "someone else");
Kerala.NameofCM();
Kerala.NameofState();
Kerala.NameofCountry();
Kerala.NameofPM();
Islamabad.NameofCM();
Islamabad.NameofState();
Islamabad.NameofCountry();
Islamabad.NameofPM();
}
}
class Country
{
public String PM, CName;
public void NameofCountry()
{System.out.println(CName);}
public void NameofPM()
{System.out.println(PM);}
public Country(String cname, String pm)
{
CName = cname;
PM = pm;
}
}
class State extends Country
{
public String CM, SName;
public void NameofCM()
{System.out.println(CM);}
public void NameofState()
{System.out.println(SName);}
public State(String cname, String pm, String sname, String cm)
{
super(cname, pm);
SName = sname;
CM = cm;
}
}