From ggc
|
01 packagepackage is used to name the directory or folder a class is in intermediate;
02
03 importimport means to make the classes and/or packages available in this program wiki.Wiki;
04
05 /**
06 * All about my application.
07 * @authorthis is the Javadoc tag for documenting who created the source code My Name Here
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 IndexOfExample
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 String x=this assignment operator makes the left side equal to the right side"Hello Jam!";
14 String y=this assignment operator makes the left side equal to the right side"Jam";
15 Wiki.out.println("index of '"+adds two numbers together or concatenates Strings togethery+adds two numbers together or concatenates Strings together"' in '"+adds two numbers together or concatenates Strings togetherx+adds two numbers together or concatenates Strings together"' is "+adds two numbers together or concatenates Strings togetherx.indexOf(y));
16 y=this assignment operator makes the left side equal to the right side"Jelly";
17 Wiki.out.println("index of '"+adds two numbers together or concatenates Strings togethery+adds two numbers together or concatenates Strings together"' in '"+adds two numbers together or concatenates Strings togetherx+adds two numbers together or concatenates Strings together"' is "+adds two numbers together or concatenates Strings togetherx.indexOf(y));
18
19 /**example of using isOkayForChildren*/
20 /*Censor censor=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Censor();
21 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 bad=this assignment operator makes the left side equal to the right side{open braces start code blocks and must be matched with a close brace"kill", "strip"}close braces end code blocks and must match an earlier open brace;
22 String text=this assignment operator makes the left side equal to the right side"The adult dog was sick.";
23 ifif executes the next statement only if the condition in parenthesis evaluates to true(censor.isOkayForChilder(bad, text))
24 {open braces start code blocks and must be matched with a close brace
25 Wiki.out.println(text);
26 }close braces end code blocks and must match an earlier open brace
27 elseelse is what happens when the if condition is false
28 {open braces start code blocks and must be matched with a close brace
29 Wiki.out.prinltn("censored");
30 }close braces end code blocks and must match an earlier open brace*/
31 }close braces end code blocks and must match an earlier open brace
32 }close braces end code blocks and must match an earlier open brace
|
Download/View intermediate/IndexOfExample.java