Given the code fragment: What is the result?
A.
A NullPointerException is thrown at runtime.
B.
No Match
C.
Match 2
D.
Match 1
Given the code fragment: What is the result?
A.
A NullPointerException is thrown at runtime.
B.
No Match
C.
Match 2
D.
Match 1
C
Answer is C
The answer is B. No Match.
C
C(Match 2). You have to use the ‘toString’ method when comparing s and sb because they are incompatible operand types – String and StringBuilder.
Match 2
Answer: C
output:
Match 2
c
C
Did exam MAY 17, 2017…This question was seen
Answer: c