Which statement is true about primitive variables?
Which statement is true about primitive variables?
Primitive variables can be compared using the == operator. This is because the == operator checks for value equality, which is applicable to primitive data types. The equals method and compareTo method are used for objects, not primitives, which makes them unsuitable for primitive comparison.
Option A is correct
Dear Admin, please fix the correct answer for this question. Equals method can never be used for primitives , only for wrappers.
A is the correct answer
Option A is correct
First Question an such a mess...
== used to compare primitive variables example int someinteger = 54; return someinteger == 54;
A is the correct answer. We cannot compare primitive variables with .equals() method but only == operator
A is the correct answer. Primitive variables DO NOT have methods declared on them so we cannot compare them with .equals() method.