1PUBLIC- is access modifier. visible to the world.
2Public means that the method is visible and can
3be called from other objects of other types.
4STATIC- is specifier, any feature that has static
5, belongs to the class.This means that you can
6call a static method without creating an
7object of the class.
8VOID- is a return type, the method does not
9return any value. void means that
10the method has no return value.
11
1PUBLIC- is access modifier. visible to the world.
2Public means that the method is visible and can
3be called from other objects of other types.
4STATIC- is specifier, any feature that has static
5, belongs to the class.This means that you can
6call a static method without creating an
7object of the class.
8VOID- is a return type, the method does not
9return any value. void means that
10the method has no return value.
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.