-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmployee92.java
48 lines (40 loc) · 1010 Bytes
/
Employee92.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
class Employee
{
private String name;
private int employeeId;
public Employee(String name, int employeeId)
{
this.name = name;
this.employeeId = employeeId;
}
public void printInfo()
{
System.out.println("Name: " + name);
System.out.println("Employee ID: " + employeeId);
}
}
class Manager extends Employee
{
private String department;
public Manager(String name, int employeeId, String department)
{
super(name, employeeId);
this.department = department;
}
public void printInfo()
{
super.printInfo();
System.out.println("Department: " + department);
}
}
public class Employee92
{
public static void main(String[] args) {
Employee emp = new Employee("John Doe", 12345);
Manager manager = new Manager("Jane Smith", 54321, "Engineering");
System.out.println("Employee Details:");
emp.printInfo();
System.out.println("\nManager Details:");
manager.printInfo();
}
}