From ggc
|
01 packagepackage is used to name the directory or folder a class is in jam;
02
03 importimport means to make the classes and/or packages available in this program wiki.Wiki;
04 /**
05 * All about my application here.
06 * @authornull Jam Jenkins
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 RunningTime
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 doSomething1() throwsthrows means that the method does not handle the given types of exceptions that may occur Exception
11 {open braces start code blocks and must be matched with a close brace
12 String dummy=this assignment operator makes the left side equal to the right side"";
13 synchronizedsynchronized means that the code block can only be executed by one thread at a time(dummy)
14 {open braces start code blocks and must be matched with a close brace
15 dummy.wait(10);
16 }close braces end code blocks and must match an earlier open brace
17 }close braces end code blocks and must match an earlier open brace
18
19 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 doSomething2() throwsthrows means that the method does not handle the given types of exceptions that may occur Exception
20 {open braces start code blocks and must be matched with a close brace
21 String dummy=this assignment operator makes the left side equal to the right side"";
22 synchronizedsynchronized means that the code block can only be executed by one thread at a time(dummy)
23 {open braces start code blocks and must be matched with a close brace
24 dummy.wait(50);
25 }close braces end code blocks and must match an earlier open brace
26 }close braces end code blocks and must match an earlier open brace
27
28 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 doSomething3() throwsthrows means that the method does not handle the given types of exceptions that may occur Exception
29 {open braces start code blocks and must be matched with a close brace
30 String dummy=this assignment operator makes the left side equal to the right side"";
31 synchronizedsynchronized means that the code block can only be executed by one thread at a time(dummy)
32 {open braces start code blocks and must be matched with a close brace
33 dummy.wait(10);
34 }close braces end code blocks and must match an earlier open brace
35 }close braces end code blocks and must match an earlier open brace
36
37 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) throwsthrows means that the method does not handle the given types of exceptions that may occur Exception
38 {open braces start code blocks and must be matched with a close brace
39 intint is the type for whole numbers and it is short for integer timesExecuted=this assignment operator makes the left side equal to the right side0;
40 intint is the type for whole numbers and it is short for integer outerExecuted=this assignment operator makes the left side equal to the right side0;
41 intint is the type for whole numbers and it is short for integer a=this assignment operator makes the left side equal to the right side10;
42 intint is the type for whole numbers and it is short for integer b=this assignment operator makes the left side equal to the right side8;
43 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 side9;
44 longlong is the type for whole numbers (they have a larger range than int) startTime=this assignment operator makes the left side equal to the right sideSystem.currentTimeMillis();
45 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<a; i++this is the increment operator, which increases the variable by 1)
46 {open braces start code blocks and must be matched with a close brace
47 outerExecuted++this is the increment operator, which increases the variable by 1;
48 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 j=this assignment operator makes the left side equal to the right side0; j<b; j++this is the increment operator, which increases the variable by 1)
49 {open braces start code blocks and must be matched with a close brace
50 doSomething1();
51 timesExecuted++this is the increment operator, which increases the variable by 1;
52 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 k=this assignment operator makes the left side equal to the right side0; k<c; k++this is the increment operator, which increases the variable by 1)
53 {open braces start code blocks and must be matched with a close brace
54 doSomething3();
55 }close braces end code blocks and must match an earlier open brace
56 }close braces end code blocks and must match an earlier open brace
57 doSomething2();
58 }close braces end code blocks and must match an earlier open brace
59 longlong is the type for whole numbers (they have a larger range than int) endTime=this assignment operator makes the left side equal to the right sideSystem.currentTimeMillis();
60 Wiki.out.println("Outer executed "+adds two numbers together or concatenates Strings togetherouterExecuted+adds two numbers together or concatenates Strings together" times.");
61 Wiki.out.println("Inner executed "+adds two numbers together or concatenates Strings togethertimesExecuted+adds two numbers together or concatenates Strings together" times.");
62 Wiki.out.println("Execution took "+adds two numbers together or concatenates Strings together(endTime-startTime)/1000.0+adds two numbers together or concatenates Strings together" seconds.");
63 }close braces end code blocks and must match an earlier open brace
64 }close braces end code blocks and must match an earlier open brace
|
Download/View jam/RunningTime.java