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
Explain an intermediate language?
How do you declare an array in java?
What is the static method?
What are generic methods?
What is hashset in java?
Which number is denoted by leading zero in java?
Explain list interface?
What is parameters example?
What is hashing in java?
how to run ecllipse with jettyserver for windows environment using batch file
What is the purpose of the enableevents() method in java programming?
How will you compute size of a structure?
What is math in java?
What is the java project architecture?
What is lastindexof in java?