You're comparing the last event to the first event for if it should be set to null. The signature you have is also incorrect, as the original post indicates this takes the date and time.
It's simpler than this, even without the use of Arrays or collections:
PHP Code:
for (int i = 0; i < this.activities.length; ++i) // don't start at 1. numEvents also won't really be usable here.
{
Event e = this.activities[i];
if (e != null)
{
if (e.getDate().isEqual(date) && e.getTime().isEqual(time))
{
this.activities[i] = null;
--this.numEvents;
// not sure if you want to instantiate a new event.
}
}
}
Now, you need to decide if you want to leave a spacer within the array or not. If memory is a non-issue, than I say just leave it, BUT you will need to modify any code in which you iterate to verify it's not null prior to accessing it. So if you hit the array[4] and it has a null on it, you cannot check the value of this since it doesn't exist. Personally, I would either leave the null over adding a default event with no data within it, or I would shift the array back.
Edit:
I should mention, this works okay in my head, but it is untested. Pretty sure its as easy as that in Java :P
Edit:
Hmm, I'm wondering as well if a [do/]while loop would be better here. You'll need to add a terminating condition too, there's no reason continuing through the array if you've already verified that the item was removed (you can only have one slot of date and time).