why we use string args in main method in java

What is String args is used for or Why we use String arg[] in main method
is a common doubt among Java beginners. First thing newbies exposed while
learning Java programming language is writing, Though
is smallest sort of program, it contains lot of useful information and concept for newbies Java programmers, one of them is main method and it's different attribute.

Though I covered bit of, while discussing, I thought to write this article to explain String args array in more detail. Let's see a simple Java HelloWorld again to understand more about String args in Java. The return-type can be any valid type or void indicating that the function does not return any value. The argument list can be empty, or can contain the arguments shown to support the use of command-line arguments.

The argument int argc is used by the operating system to pass an integer value specifying the number of command-line arguments entered by the user. The argument char *argv[] of type char. Each of the pointers in the array points to a null-terminated string in memory, which is an argument, entered at the command line.

The pointer with an index of 0 points to a string containing the name of the program (or garbage with some systems). The pointer with an index of 1 points to the first true command-line argument. The names of the arguments shown are traditional, but not required.

  • Views: 285

why is it important to write well
why is my google voice search not working
why is my fish tank turning green
why is 11 11 the time to make a wish
why do we have gravity on earth