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 class with no constructor. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Anonymous class with no constructor." Watch "Anonymous class with no constructor." New topic

Anonymous class with no constructor.

Prasad Ballari
Ranch Hand

Joined: Sep 23, 2000
Posts: 149
The JLS says, Aanonymous class can have initializers but not constructors.
Can anybody give me the sample code.
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3198

Get Certified, Guaranteed!
(Now Revised for the new Pattern)

Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
Prasad Ballari
Ranch Hand

Joined: Sep 23, 2000
Posts: 149
Thanks you are like teacher for me.
"Amit Tyagi" had posted some code yesterday that too includes some intiliazers but they are defined in Normal Local classes.That time i did't get that,but i am bit confused about which one will be executed first static block or intializer or may which ever comes early in code.And what is difference between static block and intializers?.
Jonathan Jeban
Ranch Hand

Joined: Oct 08, 2000
Posts: 52
Hi Prasad,
The Order of initialization is:
1.Static Block(initializer)
2.Instance initializer(s)

Hope this helps
I agree. Here's the link:
subject: Anonymous class with no constructor.
Similar Threads
How to get current date in October 10, 2005. 9.30 a.m format
connection pooling in struts
Java Network Question, pls help