+ 1
What is the difference between (a=b)and (a==b) in java?
2 odpowiedzi
+ 5
a=b means you are TELLING system that a is equal to b
a==b means you are ASKING the system wether a is equal to b or not?
+ 1
a=b is called assignment where the value of b is assigned to a.
a==b is a condition checking or you can call it a comparison operator which checks whether the value of a and b are equal or not.
Edit: the == is also used in Java with reference variables to check whether both of them are pointing to the same reference or not.