About Question enthuware.ocajp.i.v7.2.1342 :

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
ewebxml
Posts: 77
Joined: Sun Jun 30, 2013 10:04 pm
Contact:

About Question enthuware.ocajp.i.v7.2.1342 :

Post by ewebxml »

For this question,
did the writer accidentally use s.length instead of str.length in the explanation?
"s.length() throws NullPointerException" should be
"str.length() throws NullPointerException"

// The following is the text extract from the explanation
1. Say  str = null; for a, the first part is false and str.length() throws NullPointerException because s is null.
for b, the first part of it is true but it will still evaluate the second part  and as str is null,
s.length() throws NullPointerException.
Had it been || instead of |, the second part would not have been evaluated and no exception would have been thrown.

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

Re: About Question enthuware.ocajp.i.v7.2.1342 :

Post by admin »

Yes, it should be str. This has now been fixed.

thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests