Hi Shiva,
First of all, let's help to keep the friendly environment of
this forum alive.
Please do mention the source of the
question. && No real exam question please (as moderators say
) Food Has-A Popcorn! Food has a anonymous class that extends the
Popcorn class, although the reference variable of the anonymous
class p is of no use in case if we desire
polymorphism,
because only Popcorn methods can be called using p polymorphically;
No call to the sizzle() method, that is specific to the anonymous
class.
You are able to assign outer.p1 because superclass can hold reference
of the subclass object. p1 is the reference variable of the implementer
of the Popcorn class, so that is alright.
Regards,
cmbhatt
[ April 18, 2007: Message edited by: Chandra Bhatt ]