How do I design a class so that it supports cloning in Java?

How do I design a class so that it supports cloning?

-Define a class that implements Clonable interface.

- Override the clone() method of Object class. Some classes my need deep cloning and some shallow cloning.

- Shallow cloning is most appropriate in the situation where a data element directly represents a value. Deep cloning builds a new reference and a new object to refer to a new object.

- The Cloneable should be implemented.

- clone( ) should be overridden in which super.clone( ) is called.

- The exceptions should be caught in super.clone() so that the overridden clone( )doesn’t throw any exceptions.
Explain the complete syntax for using the Applet tag.
The Applet tag has the following attributes...
Where should we put applet class files, and how to indicate their location using the Applet tag?
An applet class file may present in any of the folder. The .class file name along with its current path...
Explain the methods that control a Applet's on-screen appearance, update and paint.
To refresh a page in an applet window without flashing, the update() method is to be overridden...
Post your comment