Which statement, when inserted into line "// TODO code application logic here ", is valid change?

Given:
<code>
public class SampleClass {
public static void main(String[] args) {
AnotherSampleClass asc = new AnotherSampleClass();
SampleClass sc = new SampleClass();
// TODO code application logic here
}
}
class AnotherSampleClass extends SampleClass {
}
</code>
Which statement, when inserted into line “// TODO code application logic here “, is valid change?

Given:

public class SampleClass {
public static void main(String[] args) {
AnotherSampleClass asc = new AnotherSampleClass();
SampleClass sc = new SampleClass();
// TODO code application logic here
}
}
class AnotherSampleClass extends SampleClass {
}

Which statement, when inserted into line “// TODO code application logic here “, is valid change?

A.
asc = sc;

B.
sc = asc;

C.
asc = (object) sc;

D.
asc = sc.clone ()

Explanation:

Works fine.
Incorrect answers:
asc = sc.clone();
Incompatible types.
asc =sc;
Incompatible types.
asc = (object) sc;
Syntax error



Leave a Reply 1

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


noir

noir

Equals another