Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extending inner class problem.

 
ramya ray
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Kindly describe whats wrong with the below code is it correct way t extend an inner class as in below code:

class so{ //outer class
so(){
System.out.println("so");
}
class s{ // inner class
s(){
System.out.println("s");
}
}
}

class c extends so.s{ //extending inner class
int i =10;

c(){
System.out.println("c");
}
public static void main(String args[]){
c c1 = new c();
}
}

while compiling it is giving error: an enclosing instance that contains so.s is required c(){
Please explain whats wrong in it

Thanks for all your support
 
wise owen
Ranch Hand
Posts: 2023
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic