Comparator class with Static methods
{"Image DocumentName": "Comparator class with Static methods", "Image ImageDescription": "// Comparator.java: A class with static data items comparision methods. class Comparator { public static int max(int a, int b) { if( a > b) return a; else. return b; } public static String max(String a, String b) if( a.compareTo (b) > 0) class MyClass { public static void main(String args[]) String s1 = Melbourne ; String s2 = Sydney ; String s3 = Adelaide ; int a = 10; int b = 20; System.out.println(Comparator.max(a, b)); // which number is big. System.out.println(Comparator.max(s1, s2)); // which city is big. System.out.println(Comparator.max(s1, s3)); // which city is big. Directly accessed using ClassName (NO Objects)", "Image XResolution": "37", "Image YResolution": "37", "Image ResolutionUnit": "Pixels/Centimeter", "Image Software": "SlidePlayer", "Image YCbCrPositioning": "Centered"}