i have a statement like this that gives an error "missing return statement".But i assigned return statements as you see.whats wrong?
public int compareTo (Object o)
{
try
{
Sports m = (Sports)o;
if(this.date.before(m.date)&& o instanceof x)
{
return -1;
}
else if(this.date.equals(m.date)&& o instanceof x)
{
return 0;
}
else
{
return 1;
}
}
catch(IllegalArgumentException e)
{
System.out.print("Not an instance of x class");
}
}
catchblock is sufficient