Prathamesh M.B.<br />Java....only.....
we can not instatiate the interface
Originally posted by seetharaman venkatasamy:
1.do not have name
2.do not have constructor
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Thanks & Regards
Sidharth Pallai
They already have. Read seetharaman venkatasamy's post dated 2nd June 13:15 and he has provided an example of a named object reated as an instance of an anonymous class which implements the MyInterface interface, with a single method.Originally posted by Sidharth Pallai:
Can anyone provide me the syntax to make an annonymous inner class extend a class or implement an interface.
Originally posted by Campbell Ritchie:
They already have. Read seetharaman venkatasamy's post dated 2nd June 13:15 and he has provided an example of a named object reated as an instance of an anonymous class which implements the MyInterface interface, with a single method.
[ June 24, 2008: Message edited by: Campbell Ritchie ]
Thanks & Regards
Sidharth Pallai
Originally posted by Sidharth Pallai:
But does an annonymous inner class can use implement keyword to implement an interface or extend to inherit a super
Thanks & Regards
Sidharth Pallai
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Spoor wrote:
Originally posted by seetharaman venkatasamy:
1.do not have name
Technically each class has a name, although for anonymous classes that name is not known at compile time. You can see those classes in the same folder as your other class files - they end with $1, $2 etc.
2.do not have constructor
Every class has a constructor, even anonymous classes. With anonymous classes you can't define your own constructors though; instead, it "inherits" all constructors of its parent class, and then redirects to that parent constructor. It's similar to the following:
Now you may thing, "but interfaces do not have constructors!"
Well, you're 100% correct. However, the parent class in that case is Object, and that certainly has a constructor. Another similarity example:
Tell the difficulties that i am difficult.