Examveda

Which of the following is good coding practice to determine oddity?
i)
public boolen abc(int num)
{
	return num % 2 == 1;
}

ii)
public boolean xyz(int num)
{
	return (num & 1)!= 0;
 }

A. i

B. ii

C. (i) causes compilation error

D. (ii) causes compilation error

Answer: Option B


This Question Belongs to Java Program >> Java Autoboxing

Join The Discussion

Related Questions on Java Autoboxing

What is autoboxing in Java?

A. The automatic conversion of primitive types to their corresponding wrapper classes

B. The process of creating a new box

C. A feature for manually converting wrapper classes to primitive types

D. A feature for boxing objects