|
01 /**
02 * All about my application here.
03 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
04 */
05 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 FindSumAndAverage
06 {open braces start code blocks and must be matched with a close brace
07 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)
08 {open braces start code blocks and must be matched with a close brace
09 intint is the type for whole numbers and it is short for integer[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 nums=this assignment operator makes the left side equal to the right side{open braces start code blocks and must be matched with a close brace3, 65, 2, 67, 1, 45, 23, -2, 6, 1}close braces end code blocks and must match an earlier open brace;
10 doubledouble is the type for numbers that can contain decimal fractions sum=this assignment operator makes the left side equal to the right side0;
11 System.out.println("Starting sum: "+adds two numbers together or concatenates Strings togethersum);
12 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<nums.length; i++this is the increment operator, which increases the variable by 1)
13 {open braces start code blocks and must be matched with a close brace
14 System.out.println("Looking at: "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arraysi]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
15 sum+=this increases the variable on the left by the value on the rightnums[brackets are typically used to declare, initialize and index (indicate which element of) arraysi]brackets are typically used to declare, initialize and index (indicate which element of) arrays;
16 System.out.println("Sum is now "+adds two numbers together or concatenates Strings togethersum);
17 }close braces end code blocks and must match an earlier open brace
18 System.out.println("Finally, the sum is "+adds two numbers together or concatenates Strings togethersum);
19 doubledouble is the type for numbers that can contain decimal fractions average=this assignment operator makes the left side equal to the right sidesum/nums.length;
20 System.out.println("Finally, the average is "+adds two numbers together or concatenates Strings togetheraverage);
21 }close braces end code blocks and must match an earlier open brace
22 }close braces end code blocks and must match an earlier open brace
|