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 the purpose of using the java bean?
Why singleton class is used in java?
What is the platform?
How do you sort an array in java?
Can a static member function access member variable of an object?
What is the default value of byte datatype in java?
why an outer class cannot be declared as private?
How can you make sure that your singleton class will always return single instance in multi-threaded environment?
if u open login & logout ,how can udisplay the timelogin & logout members ?
What is an class?
What is the benefit of inner classes in java?
What is meant by design patterns?
How to display all the prime numbers between 1 and 100
What are the approaches that you will follow for making a program very efficient?
What is mean by collections in java?