Java中的对象复制: [英] Object copy in Java:
本文介绍了Java中的对象复制:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我们在Java中将一个对象分配给同一类的另一个对象时,内存中会发生什么?
what happen in memory when we assign one object to another object of same class in java?
推荐答案
很少,因为第二个对象仅仅是对首先.如果要复制第一个元素,则需要使用 ^ ]方法.
Very little, as the second object is merely a reference to the first. If you want a copy of the first element then you need to use the clone()[^] method.
这篇关于Java中的对象复制:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文