Home  >  Forum  >  Core Java
Post New Query

java.lang.ClassCastException: cannot be cast to java.lang.Comparable



Asked on May 28, 2013
Hi All,

Need help for below error.

Exception in thread "main" java.lang.ClassCastException: cannot be cast to java.lang.Comparable
at java.util.Collections$ReverseComparator.compare(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)



Replied on May 28, 2013
The class which object is being created need to implement Comparable interface and override compareTo method.

Write Answer








©2019 concretepage.com | Privacy Policy | Contact Us