CSS font stacks & developer FAQs with Web standards
Site navigation below

One of hundreds of answers available with our premium content service.

Part answer

A: The static main() method takes a String array as an argument to provide a best match with the way that command line arguments are fed into a Java program. A Java program may be started with no command line arguments, in which case the String array is zero length, or it may have one or more arguments. The Java runtime system passes an array that matches the number of command line arguments that are given, so there is a direct correspondence between the program input and the data received by the main method.

Each storage slot in the String array passed to the main() method contains the String value of the relevant command line argument, indexed from zero. The example program below repeats the command line arguments in the order they are given.

… full answer hidden

Click for full answers

Premium members click below for full answer
Why does the main() method take a String array argument?

Home · Web fonts · Font stacks · FAQs · Java · CSS · Javascript · HTML · Site manager