A)
->In java, every method and every variable should be encapsulated. No programatical instruction should be placed outside the class. No exemption even for main method.
->To encapsulate main() method we are defining the class “helloworld”.
-> “class is a keyword in java. “helloworld” is an identifier.
->In java, class name should be start with upper case letter. if the class name has the concatenation of more than one word , every first letter should be upper case.
->Main() is declared public to give access permission to the JVM to invoke the main() without being the member of the class.
->A method of a class cannot be called without object creation unless the method is static.
->To enable JVM to call creation, main () environment for java application. But not for receiving any value from them .Therefore main () does not return type is “void”.
-> Main () token String array as parameter. It is ment for receiving commandline arguments.
->for any java application, If we give input from a text box or commandline prompt, is is considered as textual information data. Therefore, string array is made as parameter.
->Array in java has a property known as “length” that represents the size of array programmatically.
Therefore, two parameters not required to represent commandline arguments in java.
Unlike in ‘c’ (argc and argv)
Argc-> no. of commanline arguments
argv-> the value of arguments
Comments
Post a Comment