πŸ“Š JAVA
Q. 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.println(x + " " + y);
}
}
  • (A) 5 6 5 6
  • (B) 5 6 5
  • (C) Runtime error
  • (D) Compilation error
πŸ’¬ Discuss
βœ… Correct Answer: (D) Compilation error

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
217
Total Visits
πŸ“½οΈ
12 mo ago
Published
πŸŽ–οΈ
Rakesh Kumar
Publisher
πŸ“ˆ
86%
Success Rate