A class can be made static provided that the class is a nested class. A nested class is class which is defined inside a class. But top class can't me made static. Example
public class Test { static class StaticInnerClass { public static void innerMethod() { System.out.println("Static Inner Class!"); } } public static void main(String args[]) { Test.StaticInnerClass.innerMethod(); } }
Liked By
Write Answer
Can we make a class static ?
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
06-Jul-2015