package JessicaSaurerWeek3TreeLab;
/*
*
*
* @author Home
*/
import java.util.*;
import java.util.Iterator;
public class JessicaSaurerWeek3TreeLab implements Comparable<JessicaSaurerWeek3TreeLab>
{
private char one_letter;
public JessicaSaurerWeek3TreeLab (char oneletter)
{
one_letter = oneletter;
}
public int compareTo(JessicaSaurerWeek3TreeLab o)
{
if (this == o) return 0;
if (this.o < one_letter) return -1;
}
@Override
public String toString()
{
return""+one_letter;
}
public static void main(String[]args){
String fullname = " Jessica Saurer";
System.out.println("My name is" + fullname);
JessicaSaurerWeek3TreeLab oletter1 = new JessicaSaurerWeek3TreeLab("s");
JessicaSaurerWeek3TreeLab oletter2 = new JessicaSaurerWeek3TreeLab("a");
JessicaSaurerWeek3TreeLab oletter3 = new JessicaSaurerWeek3TreeLab("u");
JessicaSaurerWeek3TreeLab oletter4 = new JessicaSaurerWeek3TreeLab("r");
JessicaSaurerWeek3TreeLab oletter5 = new JessicaSaurerWeek3TreeLab("e");
JessicaSaurerWeek3TreeLab oletter6 = new JessicaSaurerWeek3TreeLab("r");
System.out.println(oletter1 + "" +oletter2);
System.out.println("Contents of treeset");
Iterator it1 = t1.iterator();
while(it1.hasNext()){
Object o1 = it1.next();
System.out.println(o1);
}
}
}
Now I am getting two different cannot find symbol errors. The first one it in the compareTo section, on the line if (this.o < one_letter) return -1;. The error is for the "o". I don't understand this error since it excepted the "o" in the line right above it. The next cannot find symbol error is in the tree set section. It says cannot find symbol JessicaSaurerWeek3TreeLab. I think it is referring to the one next to new. Again I don't understand why. Can anyone explain this to me?

New Topic/Question
Reply




MultiQuote








|