Given the code fragments: What is the result?
A.
Super Sub Sub
B.
Compilation fails at line n2
C.
Contract Contract Super
D.
Compilation fails at line n1
Given the code fragments: What is the result?
A.
Super Sub Sub
B.
Compilation fails at line n2
C.
Contract Contract Super
D.
Compilation fails at line n1
interface Contract{};
class Supper implements Contract{};
class Sub extends Supper{};
public class SampleClass {
public static final int MAX=20000;
public static void main(String[] args) {
List obj= new ArrayList();
Contract c1= new Supper();
Contract c2= new Sub();
Supper s1= new Sub();
obj.add(c1);
obj.add(c2);
obj.add(s1);
for(Object b: obj){
System.out.println(b.getClass().getName());
}
}
}
===> A
a