1.

Which of the following is good coding practice to determine oddity?
i)
public boolean Calc(int n)
{
return (n & 1)!= 0;
}

ii)
public boolen Calc(int n)
{
return n % 2 == 1;
}

A. i
B. ii
C. option (i) causes compilation error
D. option (ii) causes compilation error
E. None of these
Answer» B. ii


Discussion

No Comment Found