Wednesday, February 01, 2006

inner class calling abstract method

Shows calling of a abstract method inside a inner class

Only on j2se 1.4 and above

------------------------------Outer.java----------------------------

abstract class Helper

{

Helper()

{

doit();

}

abstract void doit();

}

class Outer

{

class Inner

extends Helper

{

void

doit()

{

Outer.this.hello();

}

}

public Outer()

{

new Inner();

}

void

hello()

{

System.out.println("hello");

}

public static void

main(String[] args)

{

new Outer();

}

}

-------------------------------------EOF-----------------------------------------------

Pradyut
http://pradyut.tk
http://spaces.msn.com/members/oop-edge/
http://groups-beta.google.com/group/oop_programming
India

No comments: