Java
T
point
Home
Python
Java
JavaScript
HTML
SQL
PHP
C#
C++
DS
Aptitude
Reasoning
Selenium
DBMS
C
Android
Interview Q
Content Menu ▼
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Question 1
:
public class Yikes {
public static void go(Long n) {System.out.print("Long ");}
public static void go(Short n) {System.out.print("Short ");}
public static void go(int n) {System.out.print("int ");}
public static void main(String [] args) {
short y = 6;
long z = 7;
go(y);
go(z);
}
}
What is the result?
1.
int Long
2.
Short Long
3.
Compilation fails.
4.
An exception is thrown at runtime.