|
01 packagepackage is used to name the directory or folder a class is in intro;
02
03
04 /**
05 * All about my application.
06 * @authorthis is the Javadoc tag for documenting who created the source code My Name Here
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 TwoDArrays
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 //declaring a collection that will be capable of holding integer variables
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[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;
14 //declaring 6 ints
15 nums=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor 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) arrays2]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) arrays3]brackets are typically used to declare, initialize and index (indicate which element of) arrays;
16 nums[brackets are typically used to declare, initialize and index (indicate which element of) arrays0]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) arrays0]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side5;
17 nums[brackets are typically used to declare, initialize and index (indicate which element of) arrays0]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) arrays1]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side6;
18 nums[brackets are typically used to declare, initialize and index (indicate which element of) arrays0]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) arrays2]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side7;
19 nums[brackets are typically used to declare, initialize and index (indicate which element of) arrays1]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) arrays0]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side1;
20 nums[brackets are typically used to declare, initialize and index (indicate which element of) arrays1]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) arrays1]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side2;
21 nums[brackets are typically used to declare, initialize and index (indicate which element of) arrays1]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) arrays2]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side3;
22 System.out.println("nums[0][0] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arrays0]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) arrays0]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
23 System.out.println("nums[0][1] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arrays0]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) arrays1]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
24 System.out.println("nums[0][2] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arrays0]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) arrays2]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
25 System.out.println("nums[1][0] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arrays1]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) arrays0]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
26 System.out.println("nums[1][1] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arrays1]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) arrays1]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
27 System.out.println("nums[1][2] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arrays1]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) arrays2]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
28 /**below performs identical function to lines 16 to 21*/
29 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;
30 ifif executes the next statement only if the condition in parenthesis evaluates to true(i<nums.length)
31 {open braces start code blocks and must be matched with a close brace
32 intint is the type for whole numbers and it is short for integer j=this assignment operator makes the left side equal to the right side0;
33 ifif executes the next statement only if the condition in parenthesis evaluates to true(j<nums[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.length)
34 nums[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[brackets are typically used to declare, initialize and index (indicate which element of) arraysj]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side5;
35 j++this is the increment operator, which increases the variable by 1;
36 ifif executes the next statement only if the condition in parenthesis evaluates to true(j<nums[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.length)
37 nums[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[brackets are typically used to declare, initialize and index (indicate which element of) arraysj]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side6;
38 j++this is the increment operator, which increases the variable by 1;
39 ifif executes the next statement only if the condition in parenthesis evaluates to true(j<nums[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.length)
40 nums[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[brackets are typically used to declare, initialize and index (indicate which element of) arraysj]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side7;
41 j++this is the increment operator, which increases the variable by 1;
42 ifif executes the next statement only if the condition in parenthesis evaluates to true(j<nums[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.length)
43 nums[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[brackets are typically used to declare, initialize and index (indicate which element of) arraysj]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side8;//would not happen when j is 3 and nums[i].length is 3
44 }close braces end code blocks and must match an earlier open brace
45 i++this is the increment operator, which increases the variable by 1;
46 ifif executes the next statement only if the condition in parenthesis evaluates to true(i<nums.length)
47 {open braces start code blocks and must be matched with a close brace
48 intint is the type for whole numbers and it is short for integer j=this assignment operator makes the left side equal to the right side0;
49 ifif executes the next statement only if the condition in parenthesis evaluates to true(j<nums[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.length)
50 nums[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[brackets are typically used to declare, initialize and index (indicate which element of) arraysj]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side5;
51 j++this is the increment operator, which increases the variable by 1;
52 ifif executes the next statement only if the condition in parenthesis evaluates to true(j<nums[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.length)
53 nums[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[brackets are typically used to declare, initialize and index (indicate which element of) arraysj]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side6;
54 j++this is the increment operator, which increases the variable by 1;
55 ifif executes the next statement only if the condition in parenthesis evaluates to true(j<nums[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.length)
56 nums[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[brackets are typically used to declare, initialize and index (indicate which element of) arraysj]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side7;
57 j++this is the increment operator, which increases the variable by 1;
58 }close braces end code blocks and must match an earlier open brace
59 i++this is the increment operator, which increases the variable by 1;
60 /**above performs identical function to lines 16 to 21*/
61 System.out.println("nums[0][0] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arrays0]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) arrays0]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
62 System.out.println("nums[0][1] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arrays0]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) arrays1]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
63 System.out.println("nums[0][2] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arrays0]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) arrays2]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
64 System.out.println("nums[1][0] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arrays1]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) arrays0]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
65 System.out.println("nums[1][1] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arrays1]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) arrays1]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
66 System.out.println("nums[1][2] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arrays1]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) arrays2]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
67
68 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 r=this assignment operator makes the left side equal to the right side0; r<nums.length; r++this is the increment operator, which increases the variable by 1)
69 {open braces start code blocks and must be matched with a close brace
70 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 c=this assignment operator makes the left side equal to the right side0; c<nums[brackets are typically used to declare, initialize and index (indicate which element of) arraysr]brackets are typically used to declare, initialize and index (indicate which element of) arrays.length; c++this is the increment operator, which increases the variable by 1)
71 {open braces start code blocks and must be matched with a close brace
72 nums[brackets are typically used to declare, initialize and index (indicate which element of) arraysr]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) arraysc]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right side(intint is the type for whole numbers and it is short for integer)(Math.random()*5);
73 System.out.println("nums["+adds two numbers together or concatenates Strings togetherr+adds two numbers together or concatenates Strings together"]["+adds two numbers together or concatenates Strings togetherc+adds two numbers together or concatenates Strings together"] is "+adds two numbers together or concatenates Strings togethernums[brackets are typically used to declare, initialize and index (indicate which element of) arraysr]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) arraysc]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
74 }close braces end code blocks and must match an earlier open brace
75 }close braces end code blocks and must match an earlier open brace
76 }close braces end code blocks and must match an earlier open brace
77 }close braces end code blocks and must match an earlier open brace
|