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 /**
05 * All about my application here.
06 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
07 */
08 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 StringMeAlong
09 {open braces start code blocks and must be matched with a close brace
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) 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)
11 {open braces start code blocks and must be matched with a close brace
12 String name=this assignment operator makes the left side equal to the right side"Jam Jenkins";
13 String removed=this assignment operator makes the left side equal to the right sidename.substring(0, 1)+adds two numbers together or concatenates Strings togethername.substring(5, name.length());
14 Wiki.out.println(removed);
15
16 String total=this assignment operator makes the left side equal to the right side"";
17 total+=this increases the variable on the left by the value on the right"howdy";
18 total+=this increases the variable on the left by the value on the right" partner,";
19 total+=this increases the variable on the left by the value on the right" how's";
20 total+=this increases the variable on the left by the value on the right" it";
21 total+=this increases the variable on the left by the value on the right" going?";
22 Wiki.out.println(total);
23
24 String sum=this assignment operator makes the left side equal to the right side"";
25 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 side0; i<total.length(); i+=this increases the variable on the left by the value on the right2)
26 {open braces start code blocks and must be matched with a close brace
27 sum+=this increases the variable on the left by the value on the righttotal.charAt(i);
28 }close braces end code blocks and must match an earlier open brace
29 Wiki.out.println(sum);
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
|
Download/View jam/StringMeAlong.java