From ggc
|
01 packagepackage is used to name the directory or folder a class is in intermediate;
02 //start auto-imports
03 importimport means to make the classes and/or packages available in this program java.util.*;
04 //end auto-imports
05
06
07 /**
08 * All about my application.
09 * @authornull Jam Jenkins
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 HashExplore
12 {open braces start code blocks and must be matched with a close brace
13 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)
14 {open braces start code blocks and must be matched with a close brace
15 HashSet<String> dictionary=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor HashSet<String>();
16 dictionary.add("Jam");
17 dictionary.add("Jenkins");
18 dictionary.add("Jelly");
19 ifif executes the next statement only if the condition in parenthesis evaluates to true(dictionary.contains("Jelly"))
20 {open braces start code blocks and must be matched with a close brace
21 System.out.println("Jelly is tere.");
22 }close braces end code blocks and must match an earlier open brace
23 elseelse is what happens when the if condition is false
24 {open braces start code blocks and must be matched with a close brace
25 System.out.println("No jelly doughnuts for you.");
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
28 }close braces end code blocks and must match an earlier open brace
|
Download/View intermediate/HashExplore.java