|
|
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 |