Question: Using the Name.java and Student.java files, expand both classes to include the following methods: A copy constructor, A clone method, A finalize method, A dispose
Using the Name.java and Student.java files, expand both classes to include the following methods: A copy constructor, A clone method, A finalize method, A dispose method, and A hashCode method. A compareTo method
Test the upgraded classes using the application TestStudentName.java Be sure to include output messages in both the finalize method and the dispose method.
I have uploaded the following code files to start:
Name.java

Student.java

TestStudentName.java


public class Name private String first //first name private String last // last name public Name) this (, "" ); public Name String firstName, String lastName) 12 3 fi rst fi rst Name ; last = lastName ; public void setName(String firstName, String lastName) fi rst fi rst Name ; last = lastName ; public Name (Name obj) throws Nul I PointerException t/ Copy Constructor public void setFirst ( String firstName) { first = firstName public void setLast (String last Name ) { last = last Name: public String getFirst) public String getLast () publ ic String getName () public void giveLast NameTo Name aName) return first return last return toSt r ing) 30 aName.setLast ast; publ ic String toStr ing) return first ast public void finalize ) public void dispose // finalize method //dispose method [ 15/ end Name
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
