-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathPerson.java
More file actions
50 lines (39 loc) · 946 Bytes
/
Person.java
File metadata and controls
50 lines (39 loc) · 946 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
package com.eazybytes.model;
public class Person {
private String firstName;
private String lastName;
private int age;
private double salary;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
if(null == lastName){
return "Unknown";
}else {
return lastName;
}
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public int getAge() {
return age;
}
public void setAge(int age) {
if(age>100) {
throw new RuntimeException("Invalid age details sent");
}else{
this.age = age;
}
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
}