Worked example
record Student(String name, int score) {
String label() {
return name + " (" + score + ")";
}
boolean passed() {
return score >= 60;
}
}
Inside the record the components are used by their plain names — name, score — without this. and without brackets.
Records fit naturally with streams: a list of records filtered and mapped reads almost like a sentence, which is what the next lessons build on.