public class Main
{
public static void main(String[] args) {
int i=0;
int j=10;
if(i>0)
if(j>0)
System.out.println("Hello World");
else
System.out.println("else");
}
}
The expected answer is "else", since i=0 and hence ELSE should be executed. The code works fine when i add curly braces to outer if.
Aucun commentaire:
Enregistrer un commentaire