Indentations in If-Else?
Indentation has absolutely no syntactic or semantic meaning in Java, and indeed in most popular languages (the main exception is Python).
Which if does your else belong to? This is an instance of the famous dangling else problem.
The syntax of Java associates each else to the innermost if, so the Java compiler understands your code in a way which is different than what your indentation suggests. If you want to associate the else with the outer if, you can use curly brackets.