From ggc
|
01 packagepackage is used to name the directory or folder a class is in intermediate.multiple;
02
03 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 SumTest
04 {open braces start code blocks and must be matched with a close brace
05
06 /**
07 * @paramthis is the Javadoc tag for documenting the purpose of parameters args
08 */
09 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)
10 {open braces start code blocks and must be matched with a close brace
11 Sum sum=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sum();
12 sum.add(5);
13 wiki.Wiki.out.println("Sum is "+adds two numbers together or concatenates Strings togethersum.getValue());
14 sum.add(6);
15 wiki.Wiki.out.println("Sum is "+adds two numbers together or concatenates Strings togethersum.getValue());
16 sum.reset();
17 wiki.Wiki.out.println("Sum is "+adds two numbers together or concatenates Strings togethersum.getValue());
18 }close braces end code blocks and must match an earlier open brace
19
20 }close braces end code blocks and must match an earlier open brace
21
|
Download/View intermediate/multiple/SumTest.java