Commit 2af899c5 by Patryk Czarnik

toString

parent 15da24ff
...@@ -26,4 +26,8 @@ class Osoba { ...@@ -26,4 +26,8 @@ class Osoba {
System.out.println("Nazywam się " + imie + " " + nazwisko + " i mam " + wiek + " lat."); System.out.println("Nazywam się " + imie + " " + nazwisko + " i mam " + wiek + " lat.");
} }
public String toString() {
return imie + " " + nazwisko + " (" + wiek + " lat)";
}
} }
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