thejwal pavithran wrote:hi guys,
i am learning about anonymous inner classes and wrote some code to help me understand it :
I tried google to clear my doubts but still i wanted to get some expert help.
So what really is the use of anonymous inner classes? is it used when there is no need to create a separate class(to reduce typing?)?.
Is there any way an instance of an anonymous inner class can be created in the main function or in some other class?(an instance of subclass of ferrari in the above code?)
Please tell me if my thinking is correct and please add any important points regarding anonymous inner classes.
thanks
An anonymous inner class is just a Method Local implementation of an existing class or interface...
For a better understanding
you should go through
this javaranch page..