Can you extend a static inner class in Java?

A static inner class is a nested class which is a static member of the outer class. It can be accessed without instantiating the outer class, using other static members. Just like static members, a static nested class does not have access to the instance variables and methods of the outer class.

You can extend static inner class with another inner class.


Live Demo

public class SampleClass {
   static abstract class Test{
      int num = 300;
      public abstract void display();
   class DemoClass extends Test{
      public void display() {
         System.out.println("Hi how are you");
   public static void main(String args[]){
      SampleClass obj = new SampleClass(); DemoClass().display();


Hi how are you