Class Name
java.lang.Object
|
+----Name
- public class Name
- extends Object
The Name class is used to store a person's name.
Currently it only supports first and last names.
This is proably overkill for such a simple object
but its purpose is to demonstrate a functional object.
-
Name()
- Constructor
-
Name(Name)
- Clone Constructor
-
Name(String, String)
- Full Constructor
-
equals(Object)
- Determine if an object is equal to this object.
-
getFirst()
- Get the value of first.
-
getLast()
- Get the value of last.
-
setFirst(String)
- Set the value of first
-
setLast(String)
- Set the value of last
-
toString()
- Convert object to String
Name
public Name()
- Constructor
Name
public Name(Name obj)
- Clone Constructor
- Parameters:
- obj - clone this object.
Name
public Name(String first,
String last)
- Full Constructor
- Parameters:
- first - - First name
- last - - Last name
setFirst
public void setFirst(String first)
- Set the value of first
getFirst
public String getFirst()
- Get the value of first.
- Returns:
- First name
setLast
public void setLast(String last)
- Set the value of last
getLast
public String getLast()
- Get the value of last.
- Returns:
- Last name
toString
public String toString()
- Convert object to String
- Returns:
- Name as "First Last".
- Overrides:
- toString in class Object
equals
public boolean equals(Object obj)
- Determine if an object is equal to this object.
- Parameters:
- obj - the object to test.
- Returns:
- true if obj is equal to this object.
- Overrides:
- equals in class Object