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.
Answer: E
bcz integer cannot convert to string
C
javac Testint.java
Testint.java:7: error: inconvertible types
String s4=(String)(s3*s2);
^
required: String
found: long
1 error