A recent article on java.net had this interesting question “Why Do Pointless if Statements Even Compile?“. I went through the article as well as the comments made by readers. It is a good one, made me think and the question seems to be really valid and not at all a stupid question. I think it would be all the more costly to do a check in the compiler rather than just allow it as it is syntactically right. The only time this would produce a side effect is when the if condition does not have an else. Otherwise putting an else would throw a compilation error “else without if”. Following a coding standard and using code check utilities like checkstyle can also help. Nevertheless it is an interesting question.