wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes a question of anonymous class 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 "a question of anonymous class" Watch "a question of anonymous class" New topic
Author

a question of anonymous class

Stephen Lee
Ranch Hand

Joined: Dec 11, 2001
Posts: 74
I have a problem....
is this sentence true or false?
An anonymous class can only be created within the body of a method. thx!
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
No, you can also create an anonymous class inside an (static or non-static) initializer block and in member initialization also.

HIH

------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: a question of anonymous class
 
Similar Threads
Passing an object to a method.
What is this technique called?
Anonymous class ???
Is it possible to create a class like this
object of an interface? Hows possible