Question 30 / 90:  Given the following code segment, what result will bee seen upon compilation and/or execution?
String value1 = "null";

String value2 = "null";

System.out.println(value1.equalsIgnoreCase(value2));

A  A NullPointerException is thrown at runtime.
B  equalsIgnoreCase is not a valid method name and causes a compilation error.
C  "true" is printed to standard out.
D  "false" is printed to standard out.
<< First < Previous Next > Last >>
Explanation:

C. Both values of "null" are the same, so the evaluation prints "true". In this scenario, the

method equalsIgnoreCase provided more functionality than was needed, and could have

been replaced with just the equals method to return "true".

A, B, and D are incorrect.

A is incorrect because there are no null values. The values are actually strings assigned the character sequence of "null".

B is incorrect because equalsignoreCase is a valid method name so no compilation error will occur.

D is incorrect because "true" is printed.

Exam Home Page
https://www.jobilize.com/quiz-my-oca-mock-exam-by-mike-wolf

My OCA Mock

Author:

Access: Public Instant Grading

Ask
Sheila Lopez
Start Exam
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/quiz-my-oca-mock-exam-by-mike-wolf" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>