From ggc
|
01 packagepackage is used to name the directory or folder a class is in intermediate;
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 Conditions
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 intint is the type for whole numbers and it is short for integer grade=this assignment operator makes the left side equal to the right side14;
13 ifif executes the next statement only if the condition in parenthesis evaluates to true(grade>=this evaluates to true if the left side is not less than the right side90)
14 System.out.println("You get an A");
15 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true(grade>=this evaluates to true if the left side is not less than the right side80)
16 System.out.println("You get a B");
17 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true(grade>=this evaluates to true if the left side is not less than the right side70)
18 System.out.println("You get a C");
19 elseelse is what happens when the if condition is false
20 System.out.println("You get a D or F");
21
22 ifif executes the next statement only if the condition in parenthesis evaluates to true(grade>=this evaluates to true if the left side is not less than the right side60)
23 {open braces start code blocks and must be matched with a close brace
24 System.out.println("You pass.");
25 }close braces end code blocks and must match an earlier open brace
26 elseelse is what happens when the if condition is false
27 {open braces start code blocks and must be matched with a close brace
28 System.out.println("You fail.");
29 ifif executes the next statement only if the condition in parenthesis evaluates to true(grade<20)
30 {open braces start code blocks and must be matched with a close brace
31 System.out.println("You really fail");
32 }close braces end code blocks and must match an earlier open brace
33 }close braces end code blocks and must match an earlier open brace
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
|
Download/View intermediate/Conditions.java