Q. What will be the output of the following Java program?
class main_class
{
public static void main(String args[])
{
int x = 9;
if (x == 9)
{
int x = 8;
System.out.println(x);
}
}
}

  • (A) 9
  • (B) 8
  • (C) Compilation error
  • (D) Runtime error
πŸ’¬ Discuss
βœ… Correct Answer: (C) Compilation error

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
286
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Priyanka Tomar
Publisher
πŸ“ˆ
82%
Success Rate