-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployeeConstructor.java
More file actions
48 lines (27 loc) · 866 Bytes
/
EmployeeConstructor.java
File metadata and controls
48 lines (27 loc) · 866 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
class Employee {
String name;
double salary;
int age;
public Employee(String name, double salary,int age) {
this.name = name;
this.salary = salary;
this.age = age;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
public double getSalary() {
return salary;
}
}
public class EmployeeConstructor{
public static void main(String[] args) {
Employee e1= new Employee("Ram", 50000, 30);
Employee e2=new Employee("Rahul", 60000, 25);
System.out.println("Name: "+e1.getName()+" Salary: "+e1.getSalary()+" Age: "+e1.getAge());
System.out.println("Name: "+e2.getName()+" Salary: "+e2.getSalary()+" Age: "+e2.getAge());
}
}