-->
当前位置:首页 > 题库

单选题:Suppose you have a class MyClass and want to easily replace the

Luz5年前 (2021-05-10)题库681
Suppose you have a class MyClass and want to easily replace the contents of one object, target, with the contents of another object of MyClass, source. Which of the following statements would correctly create the copy?
@[C](2)

A. `target = source;`
B. `target.clone(source); `
C. `target = source.clone();`
D. `target = (MyClass) source.clone();`




A.`target = source;`
B.`target.clone(source); `
C.`target = source.clone();`
D.`target = (MyClass) source.clone();`


答案:C