Construct a Person using his/her first+last names. this.firstName = firstName; this.lastName = lastName;
this.firstName = firstName; this.lastName = lastName;
Get the person's full name if (fullName != null) return fullName; return firstName + " " + lastName;
if (fullName != null) return fullName; return firstName + " " + lastName;
Simple test program. Person p = new Person("Ian", "Darwin"); String f = p.getFullName(); if (!f.equals("Ian Darwin")) throw new IllegalStateException("Name concatenation broken"); System.out.println("Fullname " + f + " looks good");
Person p = new Person("Ian", "Darwin"); String f = p.getFullName(); if (!f.equals("Ian Darwin")) throw new IllegalStateException("Name concatenation broken"); System.out.println("Fullname " + f + " looks good");