I wrote a simple if/else in my code which worked fine. Later I added another level of if under the first, and was baffled by its behavior. Here\'
It is clearly stated in Language specification 14.5. Statements:
Java programming language suffers from the so-called "dangling else problem,
Statements are thus grammatically divided into two categories: those that might end in an if statement that has no else clause (a "short if statement") and those that definitely do not.
Only statements that definitely do not end in a short if statement may appear as an immediate substatement before the keyword else in an if statement that does have an else clause.