- 1
What is different between (=) operator (==) operator ? Explain with example .
4 Antworten
+ 13
= assignment (gives value to a variable)
== equality (checks if var is equal to something else…)
+ 5
Examples:
int a = 4;
int b = 2;
int a = b; // a is given the value of b
a == 2 // this is true because a has the value of 2
+ 2
Thanks for the answer،😘😍
+ 2
the = is to value to a variable, the == allows you to check if something is equal to something