Click here to Skip to main content
15,896,118 members
Articles / Web Development

Java Anonymous Class example Program with Code

13 Feb 2015CPOL 4.2K   2  
Anonymous class does not have a name. Example of Anonymous class below: new Comparator(){} class is an Anonymous class. Collections.sort(students, new Comparator<Student>() { @Override public int compare(Student student1, Student student2) { return student1.marks - student2.marks; } });
Only logged in members can view this content

Please go to the Web Development Table of Contents to view the list of available articles in this section.