Non-final functions in java object class, JAVA Programming

Assignment Help:

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

}

}

 


Related Discussions:- Non-final functions in java object class

Javascript and coldfusion, Overview Demonstrate your knowledge of JavaS...

Overview Demonstrate your knowledge of JavaScript and ColdFusion by implementing the following functionality: Contact form • The following validation error message shou

Pseudocodes, Draw a 5 inch square on the screen using pseudocode

Draw a 5 inch square on the screen using pseudocode

Answer, a program to find the area under curve y=f(x) between x=a and x=b,i...

a program to find the area under curve y=f(x) between x=a and x=b,integrate y=f(x) between the limits of a and b

Uses of fileinputstream and fileoutputstream, Java Programming 1. Write...

Java Programming 1. Write a program in Java to find the highest of any five numbers. How do you compile and execute this Java program? 2. Write a program to explain the Exce

Conditional Execute, Write a program that prompts for two people’s birthday...

Write a program that prompts for two people’s birthdays (month and day), along with today’s month and day. The program should figure out how many days remain until each user’s birt

Board Coloring, BoardColoring.java program for 2D MXM matrix

BoardColoring.java program for 2D MXM matrix

Explain what is constructors, Explain what is constructors ? It is freq...

Explain what is constructors ? It is frequent the case in which overloaded techniques are essentially the similar except that one supplies default values for a few of the argum

Need graphic designer and developer, My name is Myers, the project director...

My name is Myers, the project director of an online business that is scheduled to commence this summer in Nigeria. We are in the process of recruiting members to the project team a

What happens to static fields of class during serialization, What happens t...

What happens to the static fields of a class during serialization? There are three exceptions in which serialization does not necessarily read and write to the stream. These

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd