You're right, the question is not off topic -- It's not a good fit for Stack Overflow.
Stack Overflow's mission is to:
we're working together to build a library of detailed answers to every question about programming
Jeff Atwood talked about Stack Overflow's mission before, he said:
It is by programmers, for programmers, with the ultimate intent of collectively increasing the sum total of good programming knowledge in the world.
And then there's the matter of what we want from a question:
Include details about what you have tried and exactly what you are trying to do
What can we glean from all this?
Questions should be useful to other people. This is the basis of our 'too localized' close reason:
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. (Emphasis mine)
Questions should have the goal of adding to useful programming knowledge that other people can share in. We're not here to solve any particular person's programming problems, we're here to provide answers to programming questions people commonly have. That means that a question should be searchable. How do you do that?
A great title that reflects the problem you're facing (hint: not "Java: Swapping Letters?")
A post that adaquately explains what you're trying to do, what you've tried, and phrased in such a way that it's helpful to other people
Those are the basics. Every question needs those qualities to have a chance to survive on this site.
The question you quoted doesn't have any of those qualities, and thus was closed. The OP can certainly improve their question and ask for it to be undeleted and re-opened, but the onus is on them, not on the community.