Quite a lot to do with this one.. so Far I have a class that looks like public class Person { private String firstName; private String lastName; public Person() { firstName = ""...
Well, here's something to get you started: "So how would I set the last name only" q[Person person = new Person(); person.setLastName("Smith");]q or q[Person person = new Person(null, "Smi...
Looks pretty good. I'd change a couple of things tho.
== is not proper for comparing Strings. use .equals() instead.
so this firstName == otherPerson.firstName && lastName == otherPerson.lastName should be like this firstName.equals( otherPerson.firstName) && lastName.equals(otherPerson.lastName)
Also, the makeCopy(Person) method may be more appropriate as a constructor instead of a method.
public Person( Person person )
{
firstName = person.firstName;
middleName = person.middleName;
lastName = person.lastName;
}
Also, for the getCopy method, take a look at the Cloneable interface, and the clone() method. It may give you a cleaner implementation. But that depends on your requirements, of course.
Oh, we didn't talk about a clone() method yet. Thanks for all the help as usual.