java.lang.ClassCastException: NameRank cannot be cast to java.lang.String

Coderanch | Nathan Doe | 8 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Implementing Comparable Interface with TreeSets

    Coderanch | 8 years ago | Nathan Doe
    java.lang.ClassCastException: NameRank cannot be cast to java.lang.String

    Root Cause Analysis

    1. java.lang.ClassCastException

      NameRank cannot be cast to java.lang.String

      at NameRank.compareTo()
    2. Unknown
      NameRank.compareTo
      1. NameRank.compareTo(NameRank.java:1)
      1 frame
    3. Java RT
      TreeSet.add
      1. java.util.TreeMap.put(TreeMap.java:545)
      2. java.util.TreeSet.add(TreeSet.java:238)
      2 frames
    4. Unknown
      CollectionsTest.main
      1. CollectionsTest.main(CollectionsTest.java:213)
      1 frame