Posts

Showing posts with the label understanding public static void main(String args[])

Internal Mechanism of public static void main(String args[])

Internal Mechanism of public static void main(String args[]) in java programming: Java: public static void main(String args[]): Let us explaining public static void main(String args[]). Java is a platform independent language in which main() method is declared as public as well as static and its return type is void. In main method a String type array parameter is passed. Let us take a look why do we write main() method as public static void main(String args[]). We will explain each term step by step as below- Why do we use public keyword: public is an access specifier in java programming i.e. it defines the scope and visibility of class members. main() is also a class member when we declare main() method as public it can be called by JVM . main() is a method which is called by JVM automatically. There are two environment in java programming one is JDK environment and another is JVM environment. If JVM calls a method written in JDK environment then that method need to be declared ...