Commit 13139bd7 by Patryk Czarnik

gettery

parent c5313972
...@@ -13,4 +13,16 @@ public class Osoba { ...@@ -13,4 +13,16 @@ public class Osoba {
public String toString() { public String toString() {
return imie + " " + nazwisko + " (" + wiek + " lat)"; return imie + " " + nazwisko + " (" + wiek + " lat)";
} }
public String getImie() {
return imie;
}
public String getNazwisko() {
return nazwisko;
}
public int getWiek() {
return wiek;
}
} }
...@@ -4,6 +4,8 @@ public class Przyklad { ...@@ -4,6 +4,8 @@ public class Przyklad {
public static void main(String[] args) { public static void main(String[] args) {
Osoba ola = new Osoba("Ola", "Malinowska", 30); Osoba ola = new Osoba("Ola", "Malinowska", 30);
System.out.println(ola); System.out.println(ola);
System.out.println(ola.getImie());
System.out.println(ola.getWiek());
Student student = new Student("Jan", "Kowalski", 20, "medycyna", 1); Student student = new Student("Jan", "Kowalski", 20, "medycyna", 1);
student.dodajOcene(4); student.dodajOcene(4);
......
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