Originally posted by Saurabh Patil:
Can you please explain "call these method directly"!!
What I mean with that is that you should not write a Java program that calls the finalize() method of any object. This is a special method that the JVM calls when necessary - when the garbage collection process is cleaning up the object.
For the clone() method, what I said is actually not true. If you want objects of your class to be cloneable, you should make your class implement interface Cloneable and provide a
public clone() method in your class, according to the documentation of interface Cloneable:
By convention, classes that implement this interface should override Object.clone (which is protected) with a public method. See Object.clone() for details on overriding this method.