Skip to main content
3 of 3
replaced http://stackoverflow.com/ with https://stackoverflow.com/

Duplicate question (but only when you know the answer)?

There are quite a few questions where the answer is the same as the answer to another (generally far more generic) question. A common example is a Java question where the OP is reporting some malfunction in his code. The root cause ends up being an incorrect String equality comparision, i.e. if (str == "value").

I know that it's frowned upon to answer duplicate questions, but the matter is that the OP probably didn't know it was a duplicate when he posted.

Indeed, the reference question for this issue (How do I compare strings in Java?) has a title which is precise and correct, but actually so precise that I would guess it's difficult to find unless you already understood the problem!.

(As an aside, I understand that if you actually debugged your code line-by-line you would find the issue, or at least something that "should work, but doesn't" leading to finding the proper question -- but then again, that probably applies for most, if not nearly all, questions on this site).

So, what would be a good course of action?

  1. Answering the question, explaining the error (adding a link to the reference question).
  2. Commenting, explaining the error (adding a link to the reference question).
  3. Marking it as duplicate with no further comment.
  4. Wait a prudent time for the OP to acknowledge the answer, then mark as duplicate.
  5. Any combination of the above?
matiash
  • 55.3k
  • 22
  • 22