Cannot find symbol variable date

V

Vojta

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();
}

}
 
S

Simon

Vojta said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top