Points to Remember
Recompile the class after making any changes
Save your program before compilation
Only run that class using java command that contains the main method, because program executions always starts form main
About main()
Why public?
Why static?
Why void?
What is String args[] ?
About main()
“main” is the function from which your program starts
Why public?
Since main method is called by the JVM that is why it is kept public so that it is accessible from outside. Remember private methods are only accessible from within the class
Why static?
If main is not static then the JRE have to create an object of the class .It is made static so that the JRE can call it without creating an object.
Also to ensure that there is only one copy of the main method per class
Why void?
Indicates that main ( ) does not return anything
What is String args[] ?
Way of specifying input (often called command-line arguments) at startup of application. More on it latter
#JavaFirstProgramDetail #ChangeDirectoryusingCMD #PassComandlineArgumentInJavaProgramm