From FANG
|
01 packagepackage is used to name the directory or folder a class is in scg.ch10;
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 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
08 /**
09 * 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)
10 * 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
11 * System.out.println to print each argument on a line by itself.
12 *
13 * @paramthis is the Javadoc tag for documenting the purpose of parameters args The command-line arguments
14 */
15 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
16 System.out.println("PrintAllArguments:");
17 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
18 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 "\"");
19 }close braces end code blocks and must match an earlier open brace
20 }close braces end code blocks and must match an earlier open brace
21 }close braces end code blocks and must match an earlier open brace
22
23 //Uploaded on Mon Mar 29 21:42:24 EDT 2010
|
Download/View scg/ch10/PrintAllArguments.java