Commit 6688a104 by Patryk Czarnik

final

parent e8a96942
......@@ -17,7 +17,8 @@ public class Osoba {
System.out.println("Nazywam się " + imie + " " + nazwisko + " i mam " + wiek + " lat.");
}
boolean jestPelnoletnia() {
// final gwarantuje, że żadna podklasa nie będzie mogła nadpisać tej metody
final boolean jestPelnoletnia() {
return wiek >= 18;
}
......
......@@ -22,7 +22,7 @@ public class Student extends Osoba {
// przykład: jestPelnoletnia()
// Taka metoda w nadklasie może być zadeklarowana jako "final" - to znaczy,
// że jest to ostateczna definicja i podklasa nie może jeje zmienić
// 2) Dodać nowe metody, których nie było w nadklasie
void dodajOcene(int ocena) {
oceny.add(ocena);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment