-
What is the output of this program?
public class scope_var
{
public static void main(String args[])
{
int a;
a = 5;
{
int b = 6;
System.out.print(a + " " + b);
}
System.out.println(a + " " + b);
}
}
-
- Compilation error
- 5 6 5 6
- 5 6 5
- Runtime error
- None of these
Correct Option: A
scope_var.java:11: error: cannot find symbol
System.out.println(a + " " + b);
^
symbol: variable b
location: class scope_var
1 error