From ggc
|
01 packagepackage is used to name the directory or folder a class is in jam;
02
03
04 importimport means to make the classes and/or packages available in this program wiki.Wiki;
05 /**
06 * All about my classclass is a group of fields and methods used for making objects 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 Sum
10 {open braces start code blocks and must be matched with a close brace
11 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer runningTotal;
12
13 publicpublic is used to indicate unrestricted access (any other class can have access) Sum()
14 {open braces start code blocks and must be matched with a close brace
15 runningTotal=this assignment operator makes the left side equal to the right side0;
16 }close braces end code blocks and must match an earlier open brace
17
18 publicpublic is used to indicate unrestricted access (any other class can have access) intint is the type for whole numbers and it is short for integer getCurrentTotal()
19 {open braces start code blocks and must be matched with a close brace
20 returnreturn means to provide the result of the method and/or cease execution of the method immediately runningTotal;
21 }close braces end code blocks and must match an earlier open brace
22
23 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value add(intint is the type for whole numbers and it is short for integer toAdd)
24 {open braces start code blocks and must be matched with a close brace
25 runningTotal=this assignment operator makes the left side equal to the right siderunningTotal+adds two numbers together or concatenates Strings togethertoAdd;
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/Sum.java