File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Regarding Inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Regarding Inheritance" Watch "Regarding Inheritance" New topic
Author

Regarding Inheritance

Sujittt Tripathyrr
Ranch Hand

Joined: Jun 21, 2006
Posts: 96
Why this code snippet gives error :

1. class Outer {
2. class Inner { }
3. }
4.
5. public class InheritInner extends Outer.Inner {
6. InheritInner () { }
7.
8. public static void main(String [ ] args) {
9. Outer o = new Outer( ) ;
10. InheritInner ii = new InheritInner( ) ;
11. }


Thanks in Advance
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
This thread.
Neelesh Bodas
Ranch Hand

Joined: Jul 20, 2006
Posts: 107

The issue is that the InheritInner constructor was not able to call the superclass's constructor, since it could not find an instance of outer class to associate to.

Making the inner class static is also an alternative solution.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding Inheritance