File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
src/main/java/com/thealgorithms Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ public class Student {
2+ private String name ;
3+ private int roll ;
4+ private String dept ;
5+ private String batch ;
6+
7+ // DEFAULT CONSTRUCTOR
8+ public Student () {}
9+
10+ // PARAMETERIZED CONSTRUCTOR
11+ public Student (String name , int roll , String dept , String batch ) {
12+ this .name = name ;
13+ this .roll = roll ;
14+ this .dept = dept ;
15+ this .batch = batch ;
16+ }
17+
18+ // COPY CONSTRUCTOR
19+ public Student (Student student ) {
20+ this .name = student .getName ();
21+ this .roll = student .getRoll ();
22+ this .dept = student .getDept ();
23+ this .batch = student .getBatch ();
24+ }
25+
26+ // GETTERS
27+ public String getName () { return name ; }
28+ public int getRoll () { return roll ; }
29+ public String getDept () { return dept ; }
30+ public String getBatch () { return batch ; }
31+
32+ // SETTERS
33+ public void setName (String name ) { this .name = name ; }
34+ public void setRoll (int roll ) { this .roll = roll ; }
35+ public void setDept (String dept ) { this .dept = dept ; }
36+ public void setBatch (String batch ) { this .batch = batch ; }
37+ }
You can’t perform that action at this time.
0 commit comments