Predict the output of the following code snippet :
int a = 1;
int b = 2;
if (a == b)
System.out.println (“Both values are equal”);
else
System.out.println (“Values are not equal”);
(a) Both values are equal
(b) Incorrect use of the == operator
(c) Values are not equal
(d) No output
Answer :
The output of the given code snippet will be Values are not equal.
Correct option is – (c) Values are not equal.