From ggc
|
01 packagepackage is used to name the directory or folder a class is in jam;
02
03 importimport means to make the classes and/or packages available in this program wiki.Wiki;
04 importimport means to make the classes and/or packages available in this program java.util.*;
05 /**
06 * All about my application here.
07 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
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 SortItOutAlready
10 {open braces start code blocks and must be matched with a close brace
11 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)
12 {open braces start code blocks and must be matched with a close brace
13 ArrayList<String> directory=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArrayList<String>();
14 Scanner scanner=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Scanner(Wiki.in);
15 String name=this assignment operator makes the left side equal to the right side"";
16 whilewhile is a looping structure for executing code repeatedly(!this is the not operator, which changes true to false and false to truename.toLowerCase().equals("done"))
17 {open braces start code blocks and must be matched with a close brace
18 Wiki.out.println("Enter next name (done to quit).");
19 name=this assignment operator makes the left side equal to the right sidescanner.next();
20 ifif executes the next statement only if the condition in parenthesis evaluates to true(!this is the not operator, which changes true to false and false to truename.toLowerCase().equals("done"))
21 directory.add(name);
22 }close braces end code blocks and must match an earlier open brace
23 Collections.sort(directory);
24 forfor is a looping structure for repeatedly executing a block of code(String one: directory)
25 Wiki.out.println(one);
26 }close braces end code blocks and must match an earlier open brace
27 }close braces end code blocks and must match an earlier open brace
|
Download/View jam/SortItOutAlready.java