1.

What will be the output of the program?

class Super { public Integer getLength() { return new Integer(4); } } public class Sub extends Super { public Long getLength() { return new Long(5); } public static void main(String[] args) { Super sooper = new Super(); Sub sub = new Sub(); System.out.println( sooper.getLength().toString() + "," + sub.getLength().toString() ); } }

A. 4, 4
B. 4, 5
C. 5, 4
D. Compilation fails.
Answer» E.


Discussion

No Comment Found

Related MCQs