About Question enthuware.ocpjp.v7.2.1399 :
Posted: Tue Jan 13, 2015 7:46 am
Case 2: This code will not work in all situations
Explanation: It will not work if assertions are disabled.
Why? I don't know for sure what the code does.
Probably it only prints PhoneNumber. And it will work even number==null or length() != 10
Or we can assume that the code really doesn't work properly if number==null. But it doesn't work in any circumstances: NPE or AssertionError - not a big deal.
I think we can't predict how ON/OFF assertion will influence on.
Explanation: It will not work if assertions are disabled.
Why? I don't know for sure what the code does.
Probably it only prints PhoneNumber. And it will work even number==null or length() != 10
Or we can assume that the code really doesn't work properly if number==null. But it doesn't work in any circumstances: NPE or AssertionError - not a big deal.
I think we can't predict how ON/OFF assertion will influence on.