ProAnswers.org

Can a class be declared as static?

We can not declare top level class as static, but only inner class can be declared static.

public class Test

{

static class InnerClass

{

    public static void InnerMethod()

    { System.out.println("Static Inner Class!"); }

}

public static void main(String args[])

{

   Test.InnerClass.InnerMethod();

}

}

//output: Static Inner Class!