From JavaWIDE Sandbox
|
01 packagepackage is used to name the directory or folder a class is in Harmon;
02
03
04 /**
05 * All about my application.
06 * @authornull bharmon
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 Sept08
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 System.out.println ( seeMovie ( 3, 5 ) );
13 System.out.println ( seeMovie ( 5, 1 ) );
14
15
16
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 getFightSong()
20 {open braces start code blocks and must be matched with a close brace
21 System.out.println ( "Go, team, go!" );
22 System.out.println ( "You can do it." );
23 System.out.println ( "You're the best," );
24 System.out.println ( "In the west." );
25
26
27
28
29 }close braces end code blocks and must match an earlier open brace
30
31
32 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 Lanterns()
33 {open braces start code blocks and must be matched with a close brace
34 System.out.println ( "*****" );
35 System.out.println ( "*********" );
36 System.out.println ( "*************" );
37 }close braces end code blocks and must match an earlier open brace
38
39 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 Lanterns1 ()
40 {open braces start code blocks and must be matched with a close brace
41 System.out.println ( "* | | | | | *" );
42 System.out.println ( "*************" );
43
44 }close braces end code blocks and must match an earlier open brace
45
46 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) String seeMovie ( doubledouble is the type for numbers that can contain decimal fractions price, intint is the type for whole numbers and it is short for integer stars )
47 {open braces start code blocks and must be matched with a close brace
48 ifif executes the next statement only if the condition in parenthesis evaluates to true ( price <=this evaluates to true if the left side is not more than the right side 5 )
49 {open braces start code blocks and must be matched with a close brace
50 returnreturn means to provide the result of the method and/or cease execution of the method immediately "very interested";
51
52 }close braces end code blocks and must match an earlier open brace
53 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true ( price >=this evaluates to true if the left side is not less than the right side 12 &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 &&) stars ==this is the comparison operator which evaluates to true if both sides are the same 5 )
54 {open braces start code blocks and must be matched with a close brace
55 returnreturn means to provide the result of the method and/or cease execution of the method immediately " sort of interested";
56
57 }close braces end code blocks and must match an earlier open brace
58 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true ( price >=this evaluates to true if the left side is not less than the right side 12 &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 &&) stars ==this is the comparison operator which evaluates to true if both sides are the same 5 )
59 {open braces start code blocks and must be matched with a close brace
60 returnreturn means to provide the result of the method and/or cease execution of the method immediately " very interested";
61 }close braces end code blocks and must match an earlier open brace
62 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true ( ( price >=this evaluates to true if the left side is not less than the right side 5 &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 &&) price <=this evaluates to true if the left side is not more than the right side 11.99 ) &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 &&) ( stars >=this evaluates to true if the left side is not less than the right side 2 &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 &&) stars <=this evaluates to true if the left side is not more than the right side 4 ) )
63 {open braces start code blocks and must be matched with a close brace
64 returnreturn means to provide the result of the method and/or cease execution of the method immediately " sort of interested";
65 }close braces end code blocks and must match an earlier open brace
66 elseelse is what happens when the if condition is false
67 {open braces start code blocks and must be matched with a close brace
68 returnreturn means to provide the result of the method and/or cease execution of the method immediately "not interested";
69 }close braces end code blocks and must match an earlier open brace
70
71 }close braces end code blocks and must match an earlier open brace
72 }close braces end code blocks and must match an earlier open brace
|
Download/View Harmon/Sept08.java