aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Cloneable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Cloneable" Watch "Cloneable" New topic
Author

Cloneable

sweety sinha
Ranch Hand

Joined: Jul 07, 2008
Posts: 76
do we have to study Cloneable interface for scjp5 ?
Milan Sutaria
Ranch Hand

Joined: Jul 10, 2008
Posts: 122
> the objectives of scjp 5 doesn't mention it
> I think theres only 1 thing to remember about cloneable interface. For implementing cloneable you dont have to define any methods; marking a class cloneable is just marking a flag for the class which enables its objects to be cloned. api of cloneable inteface shows that there are no methods.


SCJP 6 83%
Working on SCWCD/OCPJWCD
Sandeep Bhandari
Ranch Hand

Joined: Apr 16, 2004
Posts: 201
The method clone is available in every class because it is a public method in Object class.

Just implement Cloneable interface and you can use the method but if you call clone method without implementing the above mentioned interface, CloneNotSupported Exception is thrown.

Other thing to note about is deep cloning where in each object is carbon copied so that each reference of the clone refers to a new object instead of the objects referred by corresponding reference variables in the original copy.


SCJP 96% | SCWCD 90%| SCJP mock exams | My SCJP blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cloneable