First, note that it is not a logical contradiction to close a question as "unclear", just because a question has been answered or commented upon. It is entirely possible that some of the commenters and/or answerers made assumptions when attempting to respond to your question. The need to make assumptions is what makes a question unclear.
Furthermore, I want to highlight a couple of points that were made in the comments. First, various commenters have noted that your question was closed by people who have a great deal of familiarity with Java, so it is entirely unfair to represent their close votes as anything less than genuine.
Next, a gem by Jon Skeet, reminding you to consider your own bias when judging the clarity of your own content:
It's worth noting that the author of something (whether it's a question, an answer or something anywhere else in life) is the pretty much the worst judge of whether something is clear or not.
– Jon Skeet
In light of these points, please mind your tone in the future. Coming to Meta and just declaring that your question is not unclear is not very persuasive. It sets you up on a collision course with everyone who believes in the function of our community moderation. And it's just…not an argument. Your question was closed, which puts the burden of proof on you to defend it or fix it. We're happy to help you, but blaming us doesn't really help resolve the situation.
That said, I don't think your question is unclear. It might have some technical issues, but there's nothing unclear about what is being asked. I've discussed with a couple of other people who write Java rather than just drinking it, and they agreed that there's enough information there to understand what you are trying to accomplish. So, while it might be the case that the question needs to be closed for a different reason, I'm going to take a stand that it is not unclear, and that that was a poor choice of close reasons. I've re-opened your question.
It's also been pointed out to me—and I agree—that what you've brought up in your question is a practical programming problem, reflecting a situation that is not uncommon, and that it poses a bit of a challenge to solve in an elegant way. By my standards, these are the types of questions we want on Stack Overflow, rather than just endless "debug my code" sessions.
If some Java subject-matter experts want to disagree with me on the acceptability of this question, they're welcome to do so, but they'll need to provide some actual arguments. The answer box awaits.