keine Ausgabe des Geburtstags wenn Objekt null ist

This commit is contained in:
Marc Koch 2020-04-20 11:34:23 +02:00
parent ccd228fd3d
commit f20cee7650
1 changed files with 6 additions and 3 deletions

View File

@ -20,9 +20,12 @@ public class Geburtstag {
myBirthday = setMyBirthday();
System.out.println("Mein Geburtsdatum mit Geburtszeit ist:");
System.out.println(myBirthday.getDayOfMonth() + "." + myBirthday.getMonthValue() + "." + myBirthday.getYear() + ", " +
myBirthday.getHour() + ":" + myBirthday.getMinute() + " Uhr");
if (myBirthday != null) {
System.out.println("Mein Geburtsdatum mit Geburtszeit ist:");
System.out.println(myBirthday.getDayOfMonth() + "." + myBirthday.getMonthValue() + "." + myBirthday.getYear() + ", " +
myBirthday.getHour() + ":" + myBirthday.getMinute() + " Uhr");
}
/* Aufgabe c)