Which statement, when inserted into line 5, is valid change?

Given: Which statement, when inserted into line 5, is valid change?

Given: Which statement, when inserted into line 5, is valid change?

A.
asc = sc.clone ()

B.
asc = sc;

C.
sc = asc;

D.
asc = (object) sc;



Leave a Reply 2

Your email address will not be published. Required fields are marked *


imyrta

imyrta

Answer: C

Explanation:

A is wrong because clone() returns and Object and is not possible to convert from Object to AnotherSampleClass.
B is wrong because we cannot convert from SampleClass to AnotherSampleClass.
D is wrong because is not possible to convert from Object to AnotherSampleClass.