+ 1

What is the difference between (a=b)and (a==b) in java?

6th Dec 2019, 11:43 AM
Raha Hendeli
Raha Hendeli - avatar
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?
6th Dec 2019, 1:27 PM
Arsenic
Arsenic - avatar
+ 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.
6th Dec 2019, 11:53 AM
Avinesh
Avinesh - avatar