What is the use of anonymous inner classes ?
Answer Posted / reddy vatti
The use of anonymous inner classes is to access the data of
outer class.Even private data also we can access.
button.addActionListerner(new ActionListener(){
public void actionPerformed(){}
});
here we are using anonymous class to implement
ActionListener interface.If at all we are using other class
that implements ActionListener interface and passing that
obj into
button.addActionListener(obj);
In this method we cant access the private variables of the
class that call button.addActionListener();
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What do you mean by object?
What are methods in java?
What is an example of a constant variable?
Is oracle charging for java?
What is classes in java?
What is a variable and constant?
Can It is possible to synchronize the constructor of a Java Class?
Which data type is a class in java?
How to sort elements in a parallel array in java?
Explain the differences between abstraction and encapsulation?
What is string english?
Can a final method be overloaded?
What is instanceof keyword?
How do you write methodology?
Is arraylist ordered?