From FANG
|
01 packagepackage is used to name the directory or folder a class is in scg.ch09;
02
03 /**
04 * A program showing how to use a forfor is a looping structure for repeatedly executing a block of code-loop to iterate across the
05 * arguments passed in to the program when it is run.
06 *
07 * @authorthis is the Javadoc tag for documenting who created the source code blad
08 */
09 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects PrintAllArguments {open braces start code blocks and must be matched with a close brace
10 /**
11 * The mainThe main method is the place where applications begin executing. program: java PrintAllArguments starts by calling thisthis means the current object (the implicit parameter)
12 * publicpublic is used to indicate unrestricted access (any other class can have access) staticstatic means that an instance is not required for access (class level access) method. The method just uses a forfor is a looping structure for repeatedly executing a block of code-loop and
13 * System.out.println to print each argument on a line by itself.
14 *
15 * @paramthis is the Javadoc tag for documenting the purpose of parameters args The command-line arguments
16 */
17 publicpublic is used to indicate unrestricted access (any other class can have access) staticstatic means that an instance is not required for access (class level access) voidvoid means the method does not return a value mainThe main method is the place where applications begin executing.(String[brackets are typically used to declare, initialize and index (indicate which element of) arrays]brackets are typically used to declare, initialize and index (indicate which element of) arrays args) {open braces start code blocks and must be matched with a close brace
18 System.out.println("PrintAllArguments:");
19 forfor is a looping structure for repeatedly executing a block of code (intint is the type for whole numbers and it is short for integer i =this assignment operator makes the left side equal to the right side 0; i !=this is the not equals operator which evaluates to true if both sides are different args.length; ++this is the increment operator, which increases the variable by 1i) {open braces start code blocks and must be matched with a close brace
20 System.out.println(" args[" +adds two numbers together or concatenates Strings together i +adds two numbers together or concatenates Strings together "] = \"" +adds two numbers together or concatenates Strings together args[brackets are typically used to declare, initialize and index (indicate which element of) arraysi]brackets are typically used to declare, initialize and index (indicate which element of) arrays +adds two numbers together or concatenates Strings together "\"");
21 }close braces end code blocks and must match an earlier open brace
22 }close braces end code blocks and must match an earlier open brace
23 }close braces end code blocks and must match an earlier open brace
24
25 //Uploaded on Mon Mar 29 21:38:53 EDT 2010
|
Download/View scg/ch09/PrintAllArguments.java