1Because the object is not required to call the static method.
2If we make the main method non-static,
3JVM will have to create its object first and then call main() method which
4will lead to the extra memory allocation.
1public : “public” is an access specifier which can be used outside the class.
2When main method is declared
3public it means it can be used outside class.
4static : To call a method we require object. Sometimes it may be
5required to call a method without the help of object. Then we declare that
6method as static. JVM calls the main() method without creating
7object by declaring keyword static.
8If we make the main method non-static,
9JVM will have to create its object first and then call main() method which
10will lead to the extra memory allocation.
11void : void return type is used when a method does’nt return any value.
12main() method doesn’t return any value, so main() is declared as void.