An anonymous class is essentially a local class
(inside method body) without a name. Instead of defining a local class and then instantiating it, you can often use an anonymous class to combine these two steps
An anonymous class is essentially a local class
(inside metod body) without a name. Instead of defining a local class and then instantiating it, you can often use an anonymous class to combine these two steps
FeedbackAbhijeet Tomar November 17, 2011 at 10:19 AM
First of all , i would like to give thanks to making such a very useful website that is 'RoseIndia' as the name the implies the work and providing many or can say more useful topics including in the website and one thing is different from others tutorial or learning website is that the explanation part in a very easiest way...
and the last again Thank You all the members of RoseIndia.
Best Wishes.
Hi! You've miskeyed "actionPerformed".
Technically you are creating a new class, but it's a class that doesn't have a name of its own. When the code executes, one object of that class is created. I assume that when the same code is executed again, another object of the same class is created. Also, you can create an anonymous class, from a superclass or an interface, wherever a "new" object declaration is allowed, and not only in arguments.
However, the first main use of anonymous inner classes is in cases like yours, to connect your programmed object to the user interface. But the other main use of anonymous inner classes is that they are in lots of questions in the exam, to make the questions deliberately difficult to understand. So, don't relax yet! Once you pass the exam, you can relax!
anonymous classaman kumar September 30, 2011 at 6:49 PM
An anonymous class is essentially a local class (inside method body) without a name. Instead of defining a local class and then instantiating it, you can often use an anonymous class to combine these two steps
anonymous classaman kumar September 30, 2011 at 6:51 PM
An anonymous class is essentially a local class (inside metod body) without a name. Instead of defining a local class and then instantiating it, you can often use an anonymous class to combine these two steps
FeedbackAbhijeet Tomar November 17, 2011 at 10:19 AM
First of all , i would like to give thanks to making such a very useful website that is 'RoseIndia' as the name the implies the work and providing many or can say more useful topics including in the website and one thing is different from others tutorial or learning website is that the explanation part in a very easiest way... and the last again Thank You all the members of RoseIndia. Best Wishes.
static and non static nested classesGovindareddy January 12, 2012 at 12:07 AM
static in the sence we cant access the members of inner class but we can access by means of object
javaRamakant Sahu March 3, 2012 at 2:14 PM
very nice discription
anonimuse classgaurav tyagi March 22, 2012 at 10:38 AM
please provide daily life example in case of use
Well,Robert Carnegie April 4, 2012 at 6:21 PM
Hi! You've miskeyed "actionPerformed". Technically you are creating a new class, but it's a class that doesn't have a name of its own. When the code executes, one object of that class is created. I assume that when the same code is executed again, another object of the same class is created. Also, you can create an anonymous class, from a superclass or an interface, wherever a "new" object declaration is allowed, and not only in arguments. However, the first main use of anonymous inner classes is in cases like yours, to connect your programmed object to the user interface. But the other main use of anonymous inner classes is that they are in lots of questions in the exam, to make the questions deliberately difficult to understand. So, don't relax yet! Once you pass the exam, you can relax!
javarahul April 19, 2012 at 11:33 AM
Anonymous Inner Classes haven't body that class is called Anonymous Inner Classes
commentNeeraj Kumar June 3, 2012 at 9:59 AM
best answer...
Anonymous Inner ClassesRamu June 13, 2012 at 11:04 AM
Please provide real time scenario of this topic with example.
Post your Comment