Posts

Showing posts with the label cloning in java with example

Cloning in java with example

Cloning: Cloning is a technology to obtain exact copy of a plant, a bird an animal or a human being. This cloning technology available now. Cloning in java: Obtaining the exact copy of an existing object is called as cloning. There are two types of cloning           · Shallow Cloning: In this type of cloning any modifications to the original object will also modify the cloned object.           · Deep Cloning: In this type of cloning any modifications in the original object will not modify the cloned object.                     Deep cloning or copy can be achieved through serialization. This may be fast to code but will have performance implications. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 package com . javatbrains . cloning ; class Employee implements Cloneable { int id ; String name ; Employee ( int id , String name ) { this . id = id ;