|
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 * @authornull 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 TraditionalCount
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 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 brace4, 5, 2, 6, 4, 2, 56}close braces end code blocks and must match an earlier open brace;
14 intint is the type for whole numbers and it is short for integer target=this assignment operator makes the left side equal to the right side4;
15 intint is the type for whole numbers and it is short for integer count=this assignment operator makes the left side equal to the right side0;
16 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-1; i++this is the increment operator, which increases the variable by 1)
17 {open braces start code blocks and must be matched with a close brace
18 ifif executes the next statement only if the condition in parenthesis evaluates to true(i-1>=this evaluates to true if the left side is not less than the right side0 &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) i-1<nums.length)
19 {open braces start code blocks and must be matched with a close brace
20 ifif executes the next statement only if the condition in parenthesis evaluates to true(nums[brackets are typically used to declare, initialize and index (indicate which element of) arraysi-1]brackets are typically used to declare, initialize and index (indicate which element of) arrays==this is the comparison operator which evaluates to true if both sides are the sametarget)
21 {open braces start code blocks and must be matched with a close brace
22 count++this is the increment operator, which increases the variable by 1;
23 }close braces end code blocks and must match an earlier open brace
24 }close braces end code blocks and must match an earlier open brace
25 ifif executes the next statement only if the condition in parenthesis evaluates to true(nums[brackets are typically used to declare, initialize and index (indicate which element of) arraysi+adds two numbers together or concatenates Strings together1]brackets are typically used to declare, initialize and index (indicate which element of) arrays==this is the comparison operator which evaluates to true if both sides are the sametarget)
26 {open braces start code blocks and must be matched with a close brace
27 count++this is the increment operator, which increases the variable by 1;
28 }close braces end code blocks and must match an earlier open brace
29 }close braces end code blocks and must match an earlier open brace
30 Wiki.out.println("The count is "+adds two numbers together or concatenates Strings togethercount);
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
|