Given the code fragment: What is the result?
A.
Sum is 600
B.
Compilation fails at line n1.
C.
Compilation fails at line n2.
D.
A ClassCastException is thrown at line n1.
E.
A ClassCastException is thrown at line n2.
Given the code fragment: What is the result?
A.
Sum is 600
B.
Compilation fails at line n1.
C.
Compilation fails at line n2.
D.
A ClassCastException is thrown at line n1.
E.
A ClassCastException is thrown at line n2.
C
Correct Answer: C.
B,C
Correct Answer: C.
Line n1 does not give compilation error.
incompitable type error occurred its complier error not class cast exception
Erro at line n2. CastException due can’t cast from long to string. So the correct answer is letter E – A ClassCastException is thrown at line n2.
Marcos this code will not even compile hence you can’t get a ClassCastException
That’s right Bob, the correct answer is a “compilation” error, which is answer: Compilation fails at line n2. However TestKing says the answer is: A ClassCastException is thrown at line n2. TestKing is wrong again.
Correct Answer: E
Doc:
https://docs.oracle.com/javase/8/docs/api/java/lang/ClassCastException.html
c
e
E
c
tested
Did exam MAY 17, 2017…This question was seen
Answer: C
Answer: C.Compilation fails at line n2.
La C es la correcta