This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
java:anon_inner_classes [2021/04/12 06:23] gthanos [Παράδειγμα - Ανώνυμη εμφωλευμένη κλάση ως επέκταση υφιστάμενης κλάσης] |
java:anon_inner_classes [2023/03/23 20:43] gthanos [Παράδειγμα - Ανώνυμη εμφωλευμένη κλάση ως υλοποίηση ενός interface] |
||
|---|---|---|---|
| Line 54: | Line 54: | ||
| Collections.sort(students, | Collections.sort(students, | ||
| public int compare(Student st1, Student st2) { | public int compare(Student st1, Student st2) { | ||
| - | int cmp = cmp = st1.AEM - st2.AEM; | + | int cmp = st1.AEM - st2.AEM; |
| if(cmp==0) | if(cmp==0) | ||
| cmp = st1.lastName.compareTo(st2.lastName); | cmp = st1.lastName.compareTo(st2.lastName); | ||
| Line 85: | Line 85: | ||
| </ | </ | ||
| - | <code java> | + | < |
| import java.io.*; | import java.io.*; | ||
| import java.util.*; | import java.util.*; | ||