Solved Error: cannot be cast to java.lang.Comparable

This article will look at how to solve the above-given Class Cast Exception. This ClassCast Exception occurs at runtime when we improperly typecast an object of a class to a related class of which it is not an instance. Now, what does it mean when the exception says: cannot be cast to java.lang.Comparable. Let us first have a brief look at what is Comparable. We use Comparable Interface mainly when we need to sort an Array of Custom Objects. In

Read more