What is the use of anonymous inner classes ?
Answer Posted / suneetha
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 ? | 7 Yes | 4 No |
Post New Answer View All Answers
What is dynamic binding(late binding)?
how to create multithreaded program? : Java thread
Does java arraylist maintain insertion order?
What is stringwriter?
What do you mean by light weight and heavy weight components?
What do you mean Abstraction in java?
What is java abstraction with example?
What is return data type?
What is stringreader?
Is java an ide?
What is meant by JVM? Is JVM platform independent or not?
State the merge-sort principle and its time complexity.
What is assembly condition codes?
Why char array is preferred over string for storing password?
What is a locale?