From ggc
|
01 packagepackage is used to name the directory or folder a class is in intermediate;
02 //start auto-imports
03 importimport means to make the classes and/or packages available in this program java.util.*;
04 //end auto-imports
05
06
07 /**
08 * All about my helper classclass is a group of fields and methods used for making objects.
09 * @authorthis is the Javadoc tag for documenting who created the source code My Name Here
10 */
11 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 ILikeJamComparator
12 extendsextends means to customize or extend the functionality of a class Object
13 implementsimplements means providing method bodies for the methods declared in the corresponding interface Comparator<String>
14 {open braces start code blocks and must be matched with a close brace
15 publicpublic is used to indicate unrestricted access (any other class can have access) intint is the type for whole numbers and it is short for integer compare(String a, String b)
16 {open braces start code blocks and must be matched with a close brace
17 ifif executes the next statement only if the condition in parenthesis evaluates to true(a.toLowerCase().equals("jam") &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 &&)
18 b.toLowerCase().equals("jam"))
19 returnreturn means to provide the result of the method and/or cease execution of the method immediately 0;
20 ifif executes the next statement only if the condition in parenthesis evaluates to true(a.toLowerCase().equals("jam"))
21 returnreturn means to provide the result of the method and/or cease execution of the method immediately -1;
22 ifif executes the next statement only if the condition in parenthesis evaluates to true(b.toLowerCase().equals("jam"))
23 returnreturn means to provide the result of the method and/or cease execution of the method immediately 1;
24 returnreturn means to provide the result of the method and/or cease execution of the method immediately a.compareTo(b);
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
|
Download/View intermediate/ILikeJamComparator.java