normal 0 false false false en-us x-none


clone (), finalize (), toString (), equals (), hashCode () and. The other methods like wait (), getClass (), notifyAll (), notify ()

toString():

 The toString() function given by the java.lang.Object returns a string, which consists of the class name followed by an "@" sign and then unsigned hexadecimal presentation of the hashcode, As Set@162b91. This hexadecimal presentation is not what the users of your class want to see.

 

clone():

 

You have to override the clone() method very judiciously. Implementing a properly working clone method is complex and it is rarely used. You are better off providing some alternative defines of object copying or simply not giving the capability. A better approach is to give a copy constructor or a static factory function in place of a constructor.

 

finalize():

 

Unlike C++ destructors, the finalize() method in Java is unpredictable,  dangerous and usually unnecessary. Use try{} finally{} blocks in Enterprise section. The finalize() method could only be need in rare instances to terminate non-critical native resources or as a safety net.

protected void finalize() throws Throwable {

try{

//finalize subclass state

}

finally {

super.finalize();

}

}

 

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: normal 0 false false false en-us x-none
Reference No:- TGS0157362

Expected delivery within 24 Hours