Given the code fragment:
What is the result?
Sum is 600
Compilation fails at line n1.
Compilation fails at line n2.
A ClassCastException is thrown at line n1.
A ClassCastException is thrown at line n2.
3
0
Compilation fails.
-1
Given:
What is the result? A. 0:0
100:0
B.null:0
C.0:0
100:200
D.null:null 100:null
Element 0Element 1
Null element 0Null element 1
NullNull
A NullPointerException is thrown at runtime.
Given the definitions of the Bird class and the Peacock class:
and the code fragment:
Which code snippet can be inserted to print Fly.Dance. ?
Bird p = new Peacock();
Bird b = new Bird();Peacock p = (Peacock) b;
Peacock b = new Peacock ();Bird p = (Bird) b;
Bird b = new Peacock ();Peacock p = (Peacock) b;
1:2:3:4:5:
1:2:3:
An ArrayOutOfBoundsException is thrown at runtime.
10 : 30 : 6
10 : 22 : 22
10 : 22 : 20
10 : 22 : 6
And given the code fragment:
4W 100 Auto4W 150 Manual
null 0 Auto4W 150 Manual
Compilation fails only at line n1
Compilation fails only at line n2
Compilation fails at both line n1 and line n2