Page 1 of 1

About Question enthuware.ocpjp.v7.2.1590 :

Posted: Tue Oct 23, 2012 3:36 am
by ETS User
Hi,

I am struggling to understand why the loop will never be encountered?

also I am correct in saying that this is bad practice to assert input value of a public method?

Thanks.

Re: About Question enthuware.ocpjp.v7.2.1590 :

Posted: Tue Oct 23, 2012 6:50 am
by admin
ETS User wrote:Hi,

I am struggling to understand why the loop will never be encountered?
That is because the loop condition is i>0 but i is -4.
also I am correct in saying that this is bad practice to assert input value of a public method?
Thanks.
Yes, it is indeed a bad practice to check input parameters of a public method. But this question is not testing you on that concept. It will be covered in detail in other questions.

HTH,
Paul.