-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathStudent.java
More file actions
37 lines (32 loc) · 1.04 KB
/
Student.java
File metadata and controls
37 lines (32 loc) · 1.04 KB
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
public class Student {
private String name;
private int roll;
private String dept;
private String batch;
// DEFAULT CONSTRUCTOR
public Student() {}
// PARAMETERIZED CONSTRUCTOR
public Student(String name, int roll, String dept, String batch) {
this.name = name;
this.roll = roll;
this.dept = dept;
this.batch = batch;
}
// COPY CONSTRUCTOR
public Student(Student student) {
this.name = student.getName();
this.roll = student.getRoll();
this.dept = student.getDept();
this.batch = student.getBatch();
}
// GETTERS
public String getName() { return name; }
public int getRoll() { return roll; }
public String getDept() { return dept; }
public String getBatch() { return batch; }
// SETTERS
public void setName(String name) { this.name = name; }
public void setRoll(int roll) { this.roll = roll; }
public void setDept(String dept) { this.dept = dept; }
public void setBatch(String batch) { this.batch = batch; }
}