Examveda
Examveda

What will be the output of the following Java program?
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

Answer: Option B


This Question Belongs to Java Program >> Operators

Join The Discussion

Related Questions on Operators