Page 1 of 1

About Question enthuware.ocpjp.ii.v11.2.3321 :

Posted: Wed Jun 26, 2019 11:48 am
by entitybean
I think there is a bug in this question: class Book does not have a toString() method and it is not implied like accessors are in the commented line.

When I execute the given code (after adding accessors to class Book) I get this result:

Code: Select all

[Book@87aac27, Book@3e3abc88, Book@6ce253f1]
Only when I add this toString() method to class Book

Code: Select all

@Override
public String toString() {
    return genre + ":" + title;
}
I get answer 1.

Re: About Question enthuware.ocpjp.ii.v11.2.3321 :

Posted: Wed Jun 26, 2019 1:07 pm
by admin
You are right. Comment in the problem statement has been updated to "accessors and toString code not shown". Since the focus of the question is not on the code for toString, it is not shown.

thank you for your feedback!