In his single topic exams, Dan says that anonymous classes cannot be static. But in the following example (which is also from the same exam), the anonymous class is static and the example compiles. How ?
[ Jess added UBB [code] tags to make code easier to read, check 'em out! ] [ August 24, 2003: Message edited by: Jessica Sant ]
An inner class is a nested class that is not explicitly or implicitly declared static. . . . Inner classes include local, anonymous and member non-static classes
and by using 'new A(2)', you are creating object of anonymous class by calling the constructor which takes integer as parameter. Then you are keeping that object reference in a static reference. [ August 24, 2003: Message edited by: Shabbir Asiqur ]
-----------------<br />IBM XML Developer <br />SCJP 1.4
They worship nothing. They say it's because nothing is worth fighting for. Like this tiny ad: