Firstly, bear with me – I'm only about a month into Java.
In an exercise, I'm asked to proof (with a test unit) that from a certain year (x) to a certain other year (y) that there are only one day between 31st of December and the 1st of January. They suggest that I should use a for-loop to make it run through all the years in-between our x and y year.
A predefined method called daysTill is already created.
So far, I've come up with this ugly piece of code, which doesn't work:
public void testYearEnd()
{int i;
for(i = 1635; i <=2300; i++);
Date date1 = new Date(i, 31, 12);
Date date2 = new Date(i, 01, 01);
assertEquals(1, date1.daysTill(date2));
}
Can anyone bear to point out exactly where my code is failing on me?
;afterfor; add braces around the loop body (indentation is not significant in Java).