java.lang.ClassCastException

MyOwnClass cannot be cast to java.lang.Comparable

Solutions on the web19030

  • via Coderanch by Laythe Chamse, 9 months ago
    MyOwnClass cannot be cast to java.lang.Comparable
  • via Coderanch by john mater, 9 months ago
    User cannot be cast to java.lang.Comparable
  • via Coderanch by Lio Liov, 9 months ago
    Practice.Obj cannot be cast to java.lang.Comparable
  • Stack trace

    • java.lang.ClassCastException: MyOwnClass cannot be cast to java.lang.Comparable at java.util.TreeMap.put(TreeMap.java:542) at java.util.TreeSet.add(TreeSet.java:238) at MyTreeSet.main(MyTreeSet.java:21)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    2 times, 10 months ago
    Unknown user
    Once, 11 months ago
    Unknown user
    Once, 1 year ago
    Unknown user
    Once, 1 year ago