What will be the output of the following Java program?

class variable_scope

{

public static void main(String args[])

{

int x;

x = 5; 

{

int y = 6;

System. out. print(x + " " + y);

}

System. out. print(x + " " + y);

}

}

1
5 6 5
2
Compilation error
3
5 6 5 6
4
Runtime error

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation