Page 1 of 1

Re: About Question enthuware.ocpjp.v11.2.3649 :

Posted: Sat Oct 30, 2021 5:08 am
by determinator
Hey!
why answer option:
for (Blogger b: loader) {b.blog ("Hello from textbook"); }
is it correct?

after all, the condition explicitly says:
"Assume that data refers to the data that needs to be blogged."

data stored in a variable named "data" MUST be posted on a blog.

And in this answer they post completely wrong data on the blog:
"Hello from textbook".

Re: About Question enthuware.ocpjp.v11.2.3649 :

Posted: Sat Oct 30, 2021 7:11 am
by admin
Yes, it is correct. The data variable that you are referring to is the method parameter name. That is what the problem statement says, "...blog(String data) method of a blogging service...". As per the assumption, whatever this data variable points to will be blogged by the blog(String data) method.

When you call b.blog ("Hello from textbook"); , b is a reference to the blogging service and the String "Hello from textbook" will be assigned to the data variable of the blog method. In other words, within the blog method data will point to "Hello from textbook" and that will be blogged.