Oracle Java SE 21 Developer Professional 1z0-830 Question # 22 Topic 3 Discussion

Oracle Java SE 21 Developer Professional 1z0-830 Question # 22 Topic 3 Discussion

1z0-830 Exam Topic 3 Question 22 Discussion:
Question #: 22
Topic #: 3

Given:

java

void verifyNotNull(Object input) {

boolean enabled = false;

assert enabled = true;

assert enabled;

System.out.println(input.toString());

assert input != null;

}

When does the given method throw a NullPointerException?


A.

A NullPointerException is never thrown


B.

Only if assertions are enabled and the input argument is null


C.

Only if assertions are disabled and the input argument is null


D.

Only if assertions are enabled and the input argument isn't null


E.

Only if assertions are disabled and the input argument isn't null


Get Premium 1z0-830 Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.