Leave a Reply 2

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


pojo

pojo

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