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 is main string [] args?
Difference between stack and queue?
What is method in research paper?
Is string a data type in java?
What is java in detail?
What is the final keyword?
how are methods defined?
What are the different ways of creating thread?
What languages are pass by reference?
How do you compare characters in java?
How many bits are in a sentence?
What is methodological theory?
What is percentage in java?
Can we cast any other type to boolean type with type casting?
What are the differences between throw and throws?