File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes anonymous inner class question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "anonymous inner class question" Watch "anonymous inner class question" New topic

anonymous inner class question

Ase Lindskog

Joined: Apr 08, 2002
Posts: 7
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

Joined: Aug 26, 2001
Posts: 7610
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 ]

[Blog] [Blogroll] [My Reviews] My Linked In
Joshua Kueck
Ranch Hand

Joined: Mar 14, 2002
Posts: 71
..How are you declaring it final?
Ase Lindskog

Joined: Apr 08, 2002
Posts: 7
Sorry. I'm wrong. It was a local class that I declared final. Anonymous can not.Thanks guys.
I agree. Here's the link:
subject: anonymous inner class question
jQuery in Action, 3rd edition