From FANG
|
01 packagepackage is used to name the directory or folder a class is in scg.ch10;
02
03 importimport means to make the classes and/or packages available in this program java.util.ArrayList;
04
05 importimport means to make the classes and/or packages available in this program fang2.core.Game;
06 importimport means to make the classes and/or packages available in this program fang2.util.InitializeApplication;
07
08 /**
09 * Uses FANG methods to get the arguments passed into the program.
10 */
11 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 NamedArgumentsFANG
12 extendsextends means to customize or extend the functionality of a class Game {open braces start code blocks and must be matched with a close brace
13 /**
14 * List all the command-line arguments on standard output.
15 */
16 @Override
17 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup() {open braces start code blocks and must be matched with a close brace
18 System.out.println("NamedArgumentsFANG:");
19 ArrayList<String> names =this assignment operator makes the left side equal to the right side InitializeApplication.getArgumentNames();
20 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 names.size(); ++this is the increment operator, which increases the variable by 1i) {open braces start code blocks and must be matched with a close brace
21 ArrayList<String> args =this assignment operator makes the left side equal to the right side InitializeApplication.getNamedArgs(
22 names.get(i));
23 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 argumentNdx =this assignment operator makes the left side equal to the right side 0; argumentNdx !=this is the not equals operator which evaluates to true if both sides are different args.size();
24 ++this is the increment operator, which increases the variable by 1argumentNdx) {open braces start code blocks and must be matched with a close brace
25 System.out.println(" args[\"" +adds two numbers together or concatenates Strings together names.get(i) +adds two numbers together or concatenates Strings together "\"][" +adds two numbers together or concatenates Strings together
26 argumentNdx +adds two numbers together or concatenates Strings together "] = \"" +adds two numbers together or concatenates Strings together args.get(argumentNdx) +adds two numbers together or concatenates Strings together "\"");
27 }close braces end code blocks and must match an earlier open brace
28 }close braces end code blocks and must match an earlier open brace
29 }close braces end code blocks and must match an earlier open brace
30 }close braces end code blocks and must match an earlier open brace
31
32 //Uploaded on Mon Mar 29 21:38:57 EDT 2010
|
Download/View scg/ch10/NamedArgumentsFANG.java