Student.java

This commit is contained in:
Neetika23 2023-09-22 22:30:54 +05:30 committed by GitHub
parent 183e213f0e
commit 601d051f32

View File

@ -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;
}
} }