I want to know: is there any API or a query interface through which I can access Wikipedia data?
Mediawiki, the wiki platform that wikipedia uses does have an HTTP based API. See MediaWiki API.
For example, to get pages with the title stackoverflow, you call
http://en.wikipedia.org/w/api.php?action=query&titles=Stackoverflow
There are some (incomplete) Java wrappers around the API - see the Client Code - Java section of the API page for more detail.