πŸ“Š JAVA
Q. What will be the output of the following Java program?
Code:
class selection_statements 
{
    public static void main(String args[])
    {
        int var1 = 5; 
        int var2 = 6;
        if ((var2 = 1) == var1)
            System.out.print(var2);
        else 
            System.out.print(++var2);
    } 
}
  • (A) 1
  • (B) 2
  • (C) 3
  • (D) 4
πŸ’¬ Discuss
βœ… Correct Answer: (B) 2

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
89
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Ravi Shankar
Publisher
πŸ“ˆ
86%
Success Rate