In an ideal world, no - you shouldn't do this, because they're different questions.
But this world is not ideal. That question is crap and should be closed anyway: the author fails to specify the problem he's encountering. You could vote to close as "unclear" or "Off topic - Questions concerning problems with code you've written must describe the specific problem..."
...Or, you could be nice to the guy and point him toward a question that, while slightly different, will actually solve his problem. Climbing down from that ivory tower we started out in, which of the actions I've described actually helps folks learn stuff?
Indeed, while multiple variations on a single question are... kinda ok, there's really no point in hosting 10,000 "Java P0rblem - halp!" questions on the site; at some point, you have to start helping folks identify the actual problem in their code or they'll never learn how to... Well, learn.
Joel wrote about this a few years ago:
Otherwise, the basic questions would just get asked again and again, and the old timers would grow bored and leave. The quality of the newsgroup would then deteriorate to approximately the level you would expect if seventh-graders were left to themselves, in other words, Lord of the Flies.
Yeah, folks can and do find thousands of different ways to ask the same basic question, again and again and again. Heck, even this question is a near- or exact-duplicate (see the list at the end of this answer). But that doesn't mean we should keep re-inventing the wheel every time someone new comes along:
When you see a question that seems like it might reflect a common problem, don’t just answer it to get a few points. That doesn’t make the Internet any better. Instead, help us build up a library of canonical questions and answers that are more generic versions of the same question, and then start closing all the exact duplicates.
All that said, be careful not to go too crazy with this idea. The example you gave was a very poorly-asked question with a very simple (and common) problem - it's easy enough to find another question that covers the same problem. But some problems are not so simple, and it can be harder to find an existing question that covers the exact same issue. In these cases, consider doing something else:
Edit the question to clarify the problem. Not only can this remove the need for it to be closed at all, it might actually make it easier for someone to find an existing, answered question that it duplicates. Heck, I've more than once found duplicates by scanning the "related" sidebar after editing to make the title actually reflect the question.
Post an answer that relates a different question to this one. I'm doing that right now (though with a blog post instead of a meta question as my source). Sometimes, it's hard for an asker to understand a solution presented elsewhere without something that relates the problem being solved there to the one they're having - a short answer that introduces, summarizes and then links to an answer elsewhere can provide the best of both worlds: a specific, focused answer to a semi-novel question and the refined knowledge of other members of the site, ranked and reviewed over the years.
See also: