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
To change c code and place into a java application Project Description: To change c code and place into a java application Skills required are C Programming, Java, Softwar

Project Description: We need same kind of concept with some changes # Change single colors in a particular design. you need to be able to change the color of only the fox or

Test Driven Development (TDD) TDD process gives your confidence in the delivered code for the following things. 1. TDD can remove duplication of code and also disciplines t

Write a code in a c++/java  for the automaton distributed in the class that accepts keywords(cat,bat,cab). Create an input file along with these words may be two or three copies of

Describe final arguments? At last, you can declare in which method arguments are final. This means that the techniques will not directly change them. Because all arguments are

Java Programming 1. What do you understand by Java Virtual Machine? 2. Write a simple Java program to display a string message and explain the steps of compilation and execu

I need integrate template to Java system Project Description: We have around 60 files for a java backend and want to implement a template, the system is complete it requires

Normalization is a design technique that is mostly used as a guide in designing relational databases. Normalization is necessary a two step process that gives data into tabular f

1. Lifecycle Management : Individual enterprise beans do not accept to explicitly manage process allocation, object activation, thread management, or object destruction. The EJ

Write code in JavaScript to display the odd numbers among 20 to 100 using FOR statement? Note: No required to write whole HTML program. Just JavaScript code of require elemen