Hi,
You are right: the expression could be evaluated to 3 or 4. The answer b (i.e. 3) is wrong.
Try this two or three times:
public class Z {
public static void main(
String[] args) {
int j = 0;
for (int i = 0; i < 10000;i++) {
j = (int)Math.round(Math.random() + 2.50001);
if (j != 3) System.out.println("i = " + i + " j = " + j);
}
}
}
Mihai T.
[This message has been edited by Mihai T (edited June 25, 2001).]