This generates the following output ..
Parent2 Foobar null
I understand why but it compiles and fails at runtime.
Thus if you subclass a class with and inner class any method used is the
parents consturctor cannont
acces the Outer class.
Of course I may be doing something stupid but I know the instance.super
stuff and this is the referse case.
It seems a bit pathalogical and also it compiles fine even though it
will never run.
The null pointer excetion if you access OuterClass.this is not exactly
helpful either.
Any thoughts ??
Mike
class Parent1 {
public Parent1(){
callFooBar();
}
public void callFooBar(){
System.out.println(" Parent1 Foobar");
}
}
public class OuterClass {
class Parent2 extends Parent1 {
public void callFooBar(){
System.out.println(" Parent2 Foobar " +OuterClass.this);
}
}
public OuterClass() {
Parent2 p2 = new Parent2();
}
public static void main( String[] args ) {
OuterClass test1 = new OuterClass();
}
}
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]