Kenneth Van Gysegem wrote:The thing is the compareTo gets an errormessage: "returnstatement missing", but I don't see where.
The line
if(this.datumInDienst.getJaar()==o.getDatumInDienst().getJaar()) (line 78) doesn't have a corresponding else clause. So if it hits that line and the condition is false there's no return value specified.
I'm pretty sure you can simplify it a bit, though. Have a look at
java.lang.Integer#compare(int,int), which already does what is needed for a single integer. Use that on the year. If it's non-zero, just return it. Otherwise continue to the month, etc. So you only need two if statements with that.
There's also a slightly cheaty version that relies on you knowing (and enforcing) an upper limit for day and month. Just compare
day + 32*(month + 13*year)).