Created
June 6, 2017 19:52
-
-
Save MericBERBER/fadeaa3a1d7319eab027b0c4b4b403e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestComparator { | |
public static void main(String args[]){ | |
Person p1 = new Person("Meric",25); | |
Person p2 = new Person("Ali",15); | |
Person older = older(p1,p2, new PersonComparator()); | |
System.out.println("Yasi buyuk olan person :" + older.isim); // Meric | |
} | |
public static Person older(Person p1, Person p2, PersonComparator c){ | |
return c.compare(p1,p2) > 0 ? p1 : p2; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment