Skip to content

Commit 44b5865

Browse files
committed
Student.java added
1 parent 0ff2c06 commit 44b5865

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
}

0 commit comments

Comments
 (0)