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
Is multiple inheritance supported by java?
What is numel matlab?
If an object is garbage collected, can it become reachable again?
What is the properties class?
What is a boolean structure?
What is a stack class in java ?
What is literal example?
Is integer passed by reference in java?
What do you mean by chromounits in java8?
What does %d do in java?
What is anti pattern in programming?
Why for each loop is used?
What is meant by javabeans?
What is the purpose of using bufferedinputstream and bufferedoutputstream classes?
What are format specifiers in java?