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

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
entitybean
Posts: 12
Joined: Mon Apr 03, 2017 6:08 am
Contact:

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

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

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

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

Post 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!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests