just23
asked on
if else statement
My question is why output is 3 and not 2 as I expected?
public class CheckNumber{
public static void main(String []args){
int i = 0;
int j = 0;
if (i > 10)
j = 1;
else if (i == 0)
if (j == 100)
j = 2;
else
j = 3;
else
j = 4;
System.out.println(j);
}
}
public class CheckNumber{
public static void main(String []args){
int i = 0;
int j = 0;
if (i > 10)
j = 1;
else if (i == 0)
if (j == 100)
j = 2;
else
j = 3;
else
j = 4;
System.out.println(j);
}
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER