Computer Scientists are Pretty Pessimistic

Wednesday 22 June 2016

public static void main ( String args[] )

public : main () method must be declared as public since it must be called by code outside of its class when the program is started.

static : The keyword static allows main () method to be called without having to instantiate a particular instance of the class. This is necessary since main () method is called by the JVM before any objects are made.

main : All java application begin execution by calling main () method. So, we need a main method must in our code.

String args[] : In main () method there is only one parameter which is an array of instances of the class String. Objects of type String store character Strings. In this case args receive any command line arguments present when the program is executed. 

No comments:

Post a Comment