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.
About Question enthuware.ocajp.i.v7.2.1342 :
Moderators: Site Manager, fjwalraven
-
- Posts: 77
- Joined: Sun Jun 30, 2013 10:04 pm
- Contact:
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1342 :
Yes, it should be str. This has now been fixed.
thank you for your feedback!
thank you for your feedback!
Who is online
Users browsing this forum: No registered users and 7 guests