forked from harikrishnan669/OOP_Lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inheritanceclass.java
67 lines (66 loc) · 1.8 KB
/
inheritanceclass.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
class Employee
{
String name;
int age;
int phonenumber;
String address;
double salary;
void salary()
{
System.out.println("The salary is"+ salary);
}
}
class officer extends Employee
{
String specilization;
officer(String name,int age,int phonenumber,String address,double salary,String specilization)
{
this.name=name;
this.age=age;
this.phonenumber=phonenumber;
this.address=address;
this.salary=salary;
this.specilization=specilization;
}
void printdetails()
{
System.out.println("Name"+ name);
System.out.println("Age"+ age);
System.out.println("Phonenumber"+ phonenumber);
System.out.println("Address"+ address);
System.out.println("salary"+ salary);
System.out.println("Specilization"+ specilization);
}
}
class manager extends Employee
{
String department;
manager(String name,int age,int phonenumber,String address,double salary,String department)
{
this.name=name;
this.age=age;
this.phonenumber=phonenumber;
this.address=address;
this.salary=salary;
this.department=department;
}
void printdetails()
{
System.out.println("Name"+ name);
System.out.println("Age"+ age);
System.out.println("Phonenumber"+ phonenumber);
System.out.println("Address"+ address);
System.out.println("salary"+ salary);
System.out.println("Department"+ department);
}
}
public class group
{
public static void main(String args[])
{
officer office=new officer("hari",18,45434,"hari bhavan",10000,"Mtech");
manager manage=new manager("hari",18,45434,"sreehari",10000,"CSE");
office.printdetails();
manage.printdetails();
}
}