The reason for that is simple – in java every condition must be resolved as a boolean value (true of false) while in c / c++ false is 0 while true is anything else…
1
solved Why does the if statement “if(1)” give error in Java but it holds true in C++?