What will be the output of the following Java program?
class MainClass {
public static void main(String args[]) {
int x = 9;
if(x == 9) {
int x = 8;
System.out.println(y);
}
}
}
1
9
2
8
3
Compilation error
4
Runtime error
5
Question Not Attempted
What will be the output of the following Java program?
class MainClass {
public static void main(String args[]) {
int x = 9;
if(x == 9) {
int x = 8;
System.out.println(y);
}
}
}