exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 162 discussion

Actual exam question from Oracle's 1z0-819
Question #: 162
Topic #: 1
[All 1z0-819 Questions]

Given the code fragment:



What is the output?

  • A. null
  • B. 41 def 42
  • C. An exception is thrown at runtime.
  • D. def 42
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
d7bb0b2
6 months, 4 weeks ago
Selected Answer: C
C is correct, Switch use a .hascode so when is executed thown NUllPointR
upvoted 1 times
...
Omnisumem
9 months, 4 weeks ago
Selected Answer: C
Tested: Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.hashCode()" because "<local1>" is null.
upvoted 1 times
...
[Removed]
11 months, 1 week ago
Selected Answer: C
C. is correct None of the actual cases or default statements will cause a NullPointerException. But using a String with value null in the 'switch(s)' clause.
upvoted 1 times
...
Stavok
1 year ago
Selected Answer: C
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.hashCode()" because "Question162.s" is null C is correct
upvoted 1 times
...
KiraguJohn
1 year ago
C as String s is null it will throw nullpointer exception
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago