• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

anonymous inner class question

 
Ase Lindskog
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which statement is true?
A. An anonymous inner class may be declared as final
B. An anonymous inner class can be declared as private
C. An anonymous inner class can implement mutiple interfaces
D. An anonymous inner class can access final variables in any enclosing scope
E. Construction of an instance of a static inner class requires an instance of
the encloing outer class
Answer is D
I think A is also correct, anonymous class are implicit final, but you can specify final as well. Compile no problem.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Weining JJJ,
Welcome to Javaranch
Could you please show us the code you wrote that proves that A is correct? Thanks.
I'd like you to read the Javaranch Naming Policy and change your publicly displayed name to comply with our unique rule. Thank you.
[ April 16, 2002: Message edited by: Valentin Crettaz ]
 
Joshua Kueck
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
..How are you declaring it final?
 
Ase Lindskog
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry. I'm wrong. It was a local class that I declared final. Anonymous can not.Thanks guys.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic