What is the result?

Given the code fragment: What is the result?

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.



Leave a Reply 16

Your email address will not be published. Required fields are marked *


MOHAMED ELSAYED

MOHAMED ELSAYED

C

Etttat

Etttat

Correct Answer: C.

mrtsilva

mrtsilva

Correct Answer: C.
Line n1 does not give compilation error.

smith

smith

incompitable type error occurred its complier error not class cast exception

Marcos

Marcos

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.

Bob

Bob

Marcos this code will not even compile hence you can’t get a ClassCastException

bella

bella

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.

Vendetta

Vendetta

Did exam MAY 17, 2017…This question was seen

Answer: C

Jessy

Jessy

Answer: C.Compilation fails at line n2.

jeronimo

jeronimo

La C es la correcta