I really think that the user reopened it because I closed it while they were answering, frustrating the user on the way.
Maybe. That said, I don't think the duplicate you chose was very good. It's technically the same problem being solved, but the two questions seem otherwise different to me. They are both asking for debugging help, but the duplicate target you picked involves a completely different kind of bug in the program than in the question you closed (i.e. essentially it was a typographical error, not a logic error).
Should I have closed it?
Maybe? Fact is, moderation actions by the user community are often subjective. The goal should be first and foremost to ensure that the content on the site is usable by future readers, with a secondary goal of helping the user who posted the question.
While I don't agree that the target you selected would achieve either of those goals, if you honestly feel that it would, especially the first of the two, then yes, you should have closed it.
It's worth being careful and trying to make sure your actions are appropriate, but at the end of the day, assuming you did that and you still came to the conclusion that closing the question was the right thing to do, then you did the right thing.
If no, why not? Was the reopen appropriate?
Frankly, I find the answer that was posted doesn't actually answer the question. It's a bad answer in that respect. The author does seem to be trying to help, but it's not going to help the author of the question understand what they did wrong in their own code, nor to help anyone else in the future who makes a similar mistake understand their mistake.
It's like someone posted a Quicksort implementation that had a bug in it, seeking help figuring out what they did wrong, and someone else posted an answer that was effectively "you should just call the runtime library's qsort()
function". That type of answer provides an answer to a question entirely different from the one that was asked.
So, was the reopen appropriate? I personally think it probably was, inasmuch as the duplicate target you selected isn't likely to help the author of the question understand their own mistake, nor is it likely to help someone else who made a similar mistake understand theirs.
But the person who reopened the question does not seem to be really doing all that great a job providing the help that was actually needed.
If we were sure that this question was a duplicate, you could argue that leaving it closed still allows for someone with the appropriate privileges to edit the duplicate targets list, i.e. "no harm, no foul". But given the target you picked doesn't seem to be the right duplicate, it's not clear that it is in fact a duplicate of any question. So until such time as someone does identify the correct duplicate, it makes sense to leave the question open.
All that said, frankly the question itself certainly could be better. There's no evidence in the question of what the author did to solve it, and there are two completely independent components of the question — the user input, and then the actual computation — an error in either of which could be responsible for a bug. The author should have narrowed the problem to just the single component where they are sure the bug exists. Seems like there's a lot of room for improvement on all fronts on that page.
Calendar.SUNDAY
is the first week day constant, and has value 1. Why not comparec.get(Calendar.DAY_OF_WEEK)
withCalendar.SUNDAY
directly?", which... from what i can tell, being someone not super familiar with java, the OP in the question is already doing. it's effectively a different problem, with the same source assignment.