Hi. I'm hoping somone can help me. I have to put a compareTo() method in my program and I have one written but ehrn I
test it my output message gives me an error message Stack Overflow for CompareTo method. Here is what my code looks like. I know it isn't write i'm actually surprised that I got it to compile. Any help would be appricated. Thank you!
public int compareTo(Employee anEmployee)
{
final int BEFORE = -1;
final int EQUAL = 0;
final int AFTER = 1;
Employee temp = new Employee();
if ( temp == anEmployee )
{
return EQUAL;
}
if (temp.compareTo(anEmployee)< 0)
{
return BEFORE;
}
if (temp.compareTo(anEmployee)> 0)
{
return AFTER;
}
if(temp.compareTo(anEmployee))
{
}
*/
return EQUAL;
}