Search:

Type: Posts; User: knowNothing23

Search: Search took 0.07 seconds.

  1. Re: Comparable is implemented, but still " java.lang.Comparable" error appears

    So, the notation is wrong. I need to create Comparator classes that will sort my ArrayList of Items by title ...
  2. Re: Comparable is implemented, but still " java.lang.Comparable" error appears

    Well, if you guys want to help me analyze it, while I do it on my own that would be even better.

    package assignment3;
    import java.util.Calendar;
    import java.util.Date;
    import...
  3. Re: Comparable is implemented, but still " java.lang.Comparable" error appears

    I need to evaluate the rest of the code on my own. Maybe, I can get it to work. Thank you very much. I will keep you guys up to date with any progress.
  4. Re: Comparable is implemented, but still " java.lang.Comparable" error appears

    Thank you aussiemcgr.
    So, I have Item that implements the "Collections" Comparable interface and Textbook extends Item. I will not modify the compareTo() in Textbook yet

    Thank you for trying to...
  5. Re: Comparable is implemented, but still " java.lang.Comparable" error appears

    I erased my own Comparable class and now the code compiles a little further. It now crashes later and shows this:

    ----- DATABASE BEFORE SORTING: -----

    DataBase.list has been called...
  6. Re: Comparable is implemented, but still " java.lang.Comparable" error appears

    I get this when I implement Comparable<Textbook> in the Textbook class:
    Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    The interface Comparable cannot be implemented...
  7. Re: Comparable is implemented, but still " java.lang.Comparable" error appears

    There's no reason, why Textbook implements it. I read somewhere that this should not matter and I had this same problem, before I implemented this to Textbook.
  8. Re: Comparable is implemented, but still " java.lang.Comparable" error appears

    // sort and print sorted database (by id)
    Collections.sort( library.getItem() );//uses Collections class
    When removing (ArrayList), I get the error:

    Exception in thread "main"...
  9. Comparable is implemented, but still " java.lang.Comparable" error appears

    The title says it all. I get the following error:
    Exception in thread "main" java.lang.ClassCastException: assignment3.Textbook cannot be cast to java.lang.Comparable
    at...
Results 1 to 9 of 9