posted 17 years ago
Hi,
Anonymous class means anonymous inner class: Anonymous inner class comes in two flavours, one that extends another class and other that implements an interface.
d. A static reference variable can reference an instance of an anonymous class.
Yes you can do this. For that matter you can have a static refernce variable that can refer to an instance of any type of class
Try this code
class A {
static B bStatic = new B();
}
class B {}
It only means that bStatic is a static member of class A.
and you can also have
class A {
static B bStatAnnony = new B() { }; // Here bStatAnnony points to an instance of a class that extends B but it has no name
}
Hope this clears the confusion.
Thanks
Deepak