Computer Science, asked by sudipto27, 11 months ago

difference between = and == in java......3points min​

Answers

Answered by suneelgoli
1

Answer:

The = operator, generally referred as assignment operator, is used to assign a value to a variable.

Eg : int a = 10; means the value 10 will be assigned to variable a.

Whereas, == operator, is a relational operator and us used to find the equality between operands. It is used to determine wether the two operands are equal or not. Using == operator, you can compare any primitive type, such as int, float, boolean, char.

Eg:

int a = 10, b= 20;

if(a==b)

……. // Some action

This will compare wether the values of ‘a' and ‘b' are equal or not. If values are equal it will return true, else will return false.


sudipto27: this was really helpful
Similar questions