+ 2
What is anonymous class and inner class?
4 Respuestas
+ 13
As per I know,
anonymous class is one which have no name. We can pass the object of anonymous class as parameter to some function.
Inner class is a class that can be defined in a class.
I'm not sure. Correct me if I'm wrong
+ 12
IN JAVA : -
A class that have no name is known as anonymous inner class in java. It should be used if you have to override method of class or interface.
+ 7
Class with no name:-Anonymous class
Class inside a class:- Inner class
+ 5
class A {
class AnInnerClass {
}
public Runnable getRunnable() {
return new Runnable() {
public void run() {
// This is an anonymous class
}
}
}
}