• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

anonymous inner class

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1 class Boo{
2 Boo(String s){}
3 Boo(){}
4 }
5 class Bar extends Boo{
6 Bar(){}
7 Bar(String s){super(s);}
8 void zoo() {}
9 Boo f= new Boo() {String s;};
10 }
Does code in line no. 9,creates an instance of Boo or an instance of subclass of Boo?
This is Q.no 4 in self test on inner classes from Kathy&Bert book.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The topic for this thread should give you a big clue. If f is an anonymous inner class then it can't be an instance of Boo or it would have a name and wouldn't be anonymous, wouldn't it?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic