Non-final functions in java object class, JAVA Programming

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();

}

}

 

Posted Date: 7/25/2012 1:58:17 AM | Location : United States







Related Discussions:- Non-final functions in java object class, Assignment Help, Ask Question on Non-final functions in java object class, Get Answer, Expert's Help, Non-final functions in java object class Discussions

Write discussion on Non-final functions in java object class
Your posts are moderated
Related Questions
You can declare a variable by the var statement such as: var strname = some value You can also declare a variable with simply assigning a value to the variable. Although, if

Luminous Jewels - The Polishing Game Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various lum

I need a website to do online marketing Project Description: Develop a website designer/developer to develop a website from scratch. This website has to be written in Java an

Describe Member Variables vs. Local Variables ? class Car { String licensePlate = ""; // member variable double speed; = 0.0; // member variable double maxSp

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

I need 3D Globe (Android) application Project Description: Seeking a talented android programmer to prepare a simple app for Android tablet display which can feature a 3D glo

what is function

What is a Relational Database? Give the names of any three RDBMS software? Database consist of two or more then two tables are called Relational database. Oracle dabatbase S

please help please help please help please help please help please helpplease help please help

Write a program to proove that HashSet maintains random order