forked from nguyenvantra/Java-OOP-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
32 lines (26 loc) · 744 Bytes
/
Copy pathStudent.java
File metadata and controls
32 lines (26 loc) · 744 Bytes
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
package com.darkness.step2;
public class Student {
private String idStudent;
private String name;
private int age;
private String address;
// No-argument constructor
// Nếu class Student không khai báo constructor nào thì mặc địn Java sẻ gọi
// No-argument constructor
public Student() {
}
// Parameterized Constructor
// Ví dụ đối tượng Student có 2 parameter
public Student(String idStudent, String name) {
this.idStudent = idStudent;
this.name = name;
}
// Đối tượng Student có đầy đủ parameter
public Student(String idStudent, String name, int age, String address) {
super();
this.idStudent = idStudent;
this.name = name;
this.age = age;
this.address = address;
}
}