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
:
class Test{
public static void main(String[] args) {
Object obj = new int[] { 1, 2, 3 };
int[] someArray = (int[])obj;
for (int i : someArray) System.out.print(i + " ");
}
}
What is the result?
1.
1 2 3
2.
Compilation fails because of an error in line 12.
3.
Compilation fails because of an error in line 13.
4.
A ClassCastException is thrown at runtime.