What is the result?

Given:
12. public class Wow {
13. public static void go(short n) {System.out.println(“short”);}
14. public static void go(Short n) {System.out.println(“SHORT”);}
15. public static void go(Long n) {System.out.println(” LONG”);}
16. public static void main(String [] args) {
17. Short y = 6;
18. int z = 7;
19. go(y);
20. go(z);
21. }
22. }
What is the result?

Given:
12. public class Wow {
13. public static void go(short n) {System.out.println(“short”);}
14. public static void go(Short n) {System.out.println(“SHORT”);}
15. public static void go(Long n) {System.out.println(” LONG”);}
16. public static void main(String [] args) {
17. Short y = 6;
18. int z = 7;
19. go(y);
20. go(z);
21. }
22. }
What is the result?

A.
short LONG

B.
SHORT LONG

C.
An exception is thrown at runtime.

D.
Compilation fails.

Explanation:



Leave a Reply 0

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