Java - Inner Class and Inheritance

Introduction

An inner class can inherit from another inner class, a top-level class, or its enclosing class.

For example, in the following code, inner class C inherits from inner class B; inner class D inherits from its enclosing top-level class A, and inner class F inherits from inner class A.B:

class A {
  public class B {
  }

  public class C extends B {
  }

  public class D extends A {
  }
}

class E extends A {
  public class F extends B {
  }
}