Don't ask to ask, just ask
Every now and then, in online chat rooms I hang around in, someone pops in and says something in the lines of,
Foobar123:
This is bad form, for several reasons. What the person is actually asking here is,
Foobar123:
There are plenty of reasons why people who DO have the knowledge would not admit to it. By asking, you're asking for more than what you think you're asking.
You're asking people to take responsibility. You're questioning people's confidence in their abilities. You're also unnecessarily walling other people out. I often answer questions related to languages or libraries I have never used, because the answers are (in a programmer kind of way) common sense.
Alternatively, it can be seen as..
Foobar123:
..which is just lazy. If you're not willing to do the work to solve your problem, why should we?
The solution is not to ask to ask, but just to ask. Someone who is idling on the channel and only every now and then glances what's going on is unlikely to answer to your "asking to ask" question, but your actual problem description may pique their interest and get them to answer.
So, to summarize, don't ask "Any Java experts around?", but rather ask "How do I do [problem] with Java and [other relevant info]?"
Other similar problems: The XY Problem, No Hello. Further reading: How do I ask a good question?, or if you have more time: How To Ask Questions The Smart Way.