Home > Back-end > The small white, what is the copy of deep and superficial excuse me
The small white, what is the copy of deep and superficial excuse me
Time:12-07
Just learning Java on the second day, it's not a programming basis, encountered such a problem, is not very good, which can explain thoroughly the great god, feeling the information on the net the ambiguity, what is the case can abstract compare?
CodePudding user response:
Shallow test case is the only copy the reference, deep test case is to replicate a same new objects,
Such as a class
The class Person {public String name="Tom"; }
If a=new Person ();
B=a, b.n ame="Jim", the a.n ame becomes Jim, this is shallow test case,
If b=new Person (); B.n ame=a.n ame. The a.e quse (b) are equal, but b.n ame=Jim, a.n ame or Tom, this is deep test case,