The entry point for the execution in all programming language is the main(). so the question is that why we prefix out "main()" by "public" and "static"? -Answer is that firstly it is the prototype and jvm only search for the main() which is public and static and have the String[] argument. -Another reason of it is that when we create our programs in any package (if we don't declare any package in our program then it should be consider as in the default package by jvm) then the only public methods can only be accessed by the caller (in the case of main() caller is jvm) if the caller is at the another package then the program (program and caller are in the different locations), jvm is not a single unit it comprises of many classes of jdk so its locati...
Comments
Post a Comment