About Question enthuware.ocpjp.v7.2.1590 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
ETS User

About Question enthuware.ocpjp.v7.2.1590 :

Post 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.

admin
Site Admin
Posts: 10386
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 6 guests