Object Cloning

 

 

 

Foreword

Resources

Code Listings

Foil Sets

Assignments

Solutions

External Resources

SiteMap

Search

Home

 

Up ] Introductory Examples ] [ Object Cloning ] Static Method's ] Sleep and Locks ] Thread Primer ] Daemon Threads ] Thread Synchronization ] Gaurded Suspension ] Deadlock ] Virtual Machine Threads ] Volitility ] Wait-Notify ]

 

During method invocations, which take zero or more arguments and may or may not return a result, primitive types are passed by value. In the case of composite types and arrays the arguments/results are passed by reference. However there arise occasions when we would be like to pass an object by-value. Java offers a solution in the cloning operation. The example given below provides a look into the details of the cloning operation. Please refer to section 2.2 in the Java Phenomenon for more details.

Source

(a) cloneTest.java

(b) customClone.java

JAR Files: Please refer to the Java-Basics section for more information on using JAR files.

(a) cloneTest.jar

(b) customClone.jar