Monday, September 26, 2011

Quiz of the day | OCPJP (21)

Given:

3. public class Sep26 {
4. public static void main(String[] args) {
5. short f4 = 4;
6. new Sep26().go(f4);
7. new Sep26().go(new Integer(8));
8. }
9. void go(Short s) { System.out.print("S "); }
10. void go(Long l) { System.out.print("L "); }
11. void go(int i) { System.out.print("i "); }
12. void go(Number n) { System.out.print("N "); }
13. }

What is the result?

A. i L
B. i N
C. S L
D. S N
E. Compilation fails.
F. An exception is thrown at runtime.


DOWNLOAD the answer

0 comments: