• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

anonymous class

 
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



in line1,how the Food.p is assigning in PopCorn reference without telling error?what is the relation is available between popcorn and Food?
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Food HAS A Popcorn.

outer.priya();



this compiles ?
 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could be you have forgotten this old topic of yours.
 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chandra and john,
Thanks and this is my owm working program.There is nosource for this code.

Thanks.
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chandra Bhatt:

No call to the sizzle() method, that is specific to the anonymous
class.

[/QB]



Do you mean pop()?

Ciao,
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


do you means pop() ?



Hi Tommaso,

I meant




Am I correct to explain you?


cmbhatt
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic