About Question enthuware.ocpjp.v21.2.4040 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
giginar
Posts: 21
Joined: Fri Feb 07, 2025 5:36 pm
Contact:

About Question enthuware.ocpjp.v21.2.4040 :

Post by giginar »

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?

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

Re: About Question enthuware.ocpjp.v21.2.4040 :

Post by admin »

No, did you read the explanation?
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.
So default will work but not exactly as the logic given in the problem statement.

Post Reply

Who is online

Users browsing this forum: No registered users and 107 guests