Why are we allowed to have a final main method in java?
Can anyone tell me the use of making main method as final in java. while this is allowed in java public static final void main(String[] args) { } I dont see any use of making it final. anyways it is static so we can not override it. aioobe Adding final to a static method can actually make a difference. Consider the following code: class A { public static void main(String[] args) { System.out.println("A"); } } class B extends A { public static void main(String[] args) { System.out.println("B"); } } class C extends B { } public class Test { public static void main(String[] args) { C.main(args);