[Solved] Implementing Comparable [closed]


Exception in thread “main” java.lang.ClassCastException: A cannot be cast to java.lang.Comparable

This means the version of A you are running is not Comparable. Most likely you have two versions of A or you didn’t build the class correctly. I suggest using an IDE to build you classes and doing a clean build should fix this.

BTW: All your A are the same, so sorting them won’t do anything. You can fix these once you have fixed the build.

solved Implementing Comparable [closed]