About Question enthuware.ocpjp.v21.2.4040 :
Moderator: admin
-
- Posts: 21
- Joined: Fri Feb 07, 2025 5:36 pm
- Contact:
About Question enthuware.ocpjp.v21.2.4040 :
the default one (option 3) is false because: "all the building subclasses(hotel, hospital) are covered, except for "null" case, so we need null, not default" is that true?
-
- Site Admin
- Posts: 10436
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v21.2.4040 :
No, did you read the explanation?
So default will work but not exactly as the logic given in the problem statement.This is syntactically valid but does not implement the logic given in the problem statement. If b is null, this code will throw a NullPointerException while the code in the problem statement will not.
Who is online
Users browsing this forum: No registered users and 107 guests