-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
38 lines (31 loc) · 707 Bytes
/
Student.java
File metadata and controls
38 lines (31 loc) · 707 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
33
34
35
36
37
38
package lambda;
import java.util.Arrays;
import java.util.List;
public class Student {
private String name;
private double gpa;
private List<String> courses;
public Student(String name, double gpa, String ... courses) {
this.name = name;
this.gpa = gpa;
this.courses = Arrays.asList(courses);
}
public String getName() {
// String name = "fred";
return name; // this prefix implied
}
public double getGpa() {
return gpa;
}
public List<String> getCourses() {
return courses;
}
@Override
public String toString() {
return "Student{" +
"name='" + name + '\'' +
", gpa=" + gpa +
", courses=" + courses +
'}';
}
}