Ok bit confused here, Practice Exam 3 question 50 of Whizlabs exam simulator
the below code is compiled with assertions enabled
public class AssertDemo {
public static void main(
String[] args) {
// TODO Auto-generated method stub
boolean assertEnabled = false;
//assert (assertEnabled==true);
assert assertEnabled = true;
System.out.println("Assertions are"+(assertEnabled?"enabled":"disabled"));
}
}
yet it supposedly is run without aserstions so somehow the assert assertEnabled = true;(assignment) doesn't get run...
so my question is, if you compile something with enabled assertions and run it without enabled assertions it ignores the assertions?
but if you compile it without assertions and run it without assertions enabled it appears that assertions are enabled? doesn't make sense? can anyone concur? or even explain?