<AptiCode/>

Question 752: class Boo { Boo(String s) { } Boo() { } } class Bar extends Boo { Bar() { } Bar(String s) {super(s);} void zoo() { // insert code here } }which one create an anonymous inner class from within class Bar?

tcs
wipro
infosys
general
aptitude
inner-classes
java-programming

Option B is correct because anonymous inner classes are no different from any other class when it comes to polymorphism. That means you are always allowed to declare a reference variable of the superclass type and have that reference variable refer to an instance of a subclass type, which in this case is an anonymous subclass ofBar. Since Bar is a subclass ofBoo, it all works.Option A is incorrect because it passes an int to theBooconstructor, and there is no matching constructor in theBooclass.Option C is incorrect because it violates the rules of polymorphism—you cannot refer to a superclass type using a reference variable declared as the subclass type. The superclass is not guaranteed to have everything the subclass has.Option D uses incorrect syntax.