class T{ abstract class I{ I(){T t = new T(); } void method(){}; } class Ne extends T.I{ void method (){ System.out.println("asD"); } public static void main(String s[]){ Ne n = new Ne(); n.method(); } } /* This is the error iam getting No enclosing instance of class T is in scope; cannot create a default constructor for class Ne. class Ne extends T.I{ ^*/
Thiru Thangavelu
Ranch Hand
Joined: Aug 29, 2001
Posts: 219
posted
0
The problem with your code is, you are trying to extend an non-static class with without instantiation. See the I in this -->class Ne extends T.I This code can be successfully compied if you make the line ----> abstract class I{ ----> static abstract class I{ Let me know if you have probs.
Thanks,<br />Thiru<br />[SCJP,SCWCD,SCBCD]
Francisco A Guimaraes
Ranch Hand
Joined: Mar 20, 2002
Posts: 182
posted
0
another way to solve the problem:
I know it�s a little more complicated, but i think it�s an worthy alternative. I took this example from Eckel�s "Thinking in Java". Francisco
Francisco<br />SCJP<br />please use the [code][/code] tags when showing code.Click <a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=ubb_code_page" target="_blank" rel="nofollow">here</a> to see an example.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: I still have problems creating abstract inner classes?