Cannot find symbol variable date

Discussion in 'Java' started by Vojta, Oct 11, 2006.

  1. Vojta

    Vojta Guest

    Please, what is wrong in code below? Why do I get compiler error "cannot
    find symbol variable date" in compareTo method of class TestItem?

    Thank you!

    public class Test<TestItem> implements Iterable<TestItem> {

    public class TestItem implements Comparable<TestItem> {

    public Date date;

    public TestItem() {
    }

    public int compareTo(TestItem anotherItem) {
    return date.compareTo(anotherItem.date);
    ^
    *** Cannot find symbol: variable date ***___|

    }
    }

    private Vector<TestItem> items;

    public Test() {
    items = new Vector<TestItem>();
    }

    public Iterator<TestItem> iterator() {
    return items.iterator();
    }

    }
    Vojta, Oct 11, 2006
    #1
    1. Advertising

  2. Vojta

    Simon Guest

    Vojta schrieb:
    > Please, what is wrong in code below? Why do I get compiler error "cannot
    > find symbol variable date" in compareTo method of class TestItem?


    Let me answer your question with a counter question. What is the intention of
    the following line?

    > public class Test<TestItem> implements Iterable<TestItem> {

    ^^^^^^^^ ^^^^^^^^
    Cheers,
    Simon
    Simon, Oct 11, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    1
    Views:
    593
    Matthew Speed
    Nov 8, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,242
    Michael Borgwardt
    May 30, 2004
  3. Matt
    Replies:
    2
    Views:
    511
    Pete Becker
    Nov 8, 2003
  4. KyoGaSuki
    Replies:
    15
    Views:
    977
    Chase Preuninger
    Apr 4, 2008
  5. Replies:
    6
    Views:
    1,766
Loading...

Share This Page