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 About anonymous inner 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 "About anonymous inner class!" Watch "About anonymous inner class!" New topic

About anonymous inner class!

Tony Sam
Ranch Hand

Joined: Nov 19, 2001
Posts: 32
hi here,
Could a anonymous inner class have its own constructor ? if yes, could someone give me a sample about this, Some books say Yes,others say No. i am really really confused ...
Thanx in advance

Tony Sam<BR>One want to be a SCJP...
Ranch Hand

Joined: Nov 22, 2001
Posts: 110
hi sam,
no const in annonemus class
intilize block
like this:
new Ann()
Muhammad Hussain

Muhammad Hussain<br />Sun Certified Java Programer (SCJP2)<br />Sun Certified Web Component Devloper SCWCD
Nain Hwu
Ranch Hand

Joined: Sep 16, 2001
Posts: 139
Just think why it is called "anonymous"?
It has no name and a constructor must have the same name as
its class. So, it is impossible to have a constructor for an anonymous class.
Uma Viswanathan
Ranch Hand

Joined: Jun 14, 2001
Posts: 126
You cannot have constructor for anonymous inner class but if the parent class have constructors,then we can arrange to invoke one of the parent class constructors by passing the appropriate arguments...
I agree. Here's the link:
subject: About anonymous inner class!
It's not a secret anymore!