Student.java
This commit is contained in:
parent
183e213f0e
commit
601d051f32
@ -1,27 +1,16 @@
|
|||||||
package com.baeldung.shallowdeepcopy;
|
package com.baeldung.shallowdeepcopy;
|
||||||
|
|
||||||
class Student {
|
class Student {
|
||||||
private String name;
|
private String name;
|
||||||
private int rollno;
|
private int age;
|
||||||
|
private School school;
|
||||||
public Student(String name, int rollno) {
|
public Student(String name, int age, School school) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.rollno = rollno;
|
this.rollno = rollno;
|
||||||
}
|
this.school = school;
|
||||||
|
}
|
||||||
public String getName() {
|
public Student(Student st) {
|
||||||
return name;
|
this(st.getName(), st.getAge(), st.getSchool());
|
||||||
}
|
} // standard getters and setters
|
||||||
public int getRollno() {
|
|
||||||
return rollno;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRollno(int rollno) {
|
|
||||||
this.rollno = rollno;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user