In the exercise 5, Sorting-Comparator project, there are 2 java
classes created.

The lesson has following codes:
// Get String Comparator object and sort the list
Comparator comp = MyComparators.stringComparator();
Collections.sort(a1, comp);


My question is since MyComparators is a class, how come I don't need
to create an instance for that before using it's method?

I usually have to create an instance first:
MyComparators mc = new MyComparators() ;
mc.stringComparator()

Please advise. Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Java Programming" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jpassion_java?hl=en.

Reply via email to