+ 1
Whats the difference between = and ==
I just did a coding lesson on scanner booleans where if statements were used to see if a situation was either false or true with a boolean input, but whenever I called upon the code holding the input and used = to see if it was literally true or false, it always defaulted to true, whereas == called upon the actual input. I have no idea why this is and it flusters me. I get == is for literals, but what is the purpose for = then? It usually works just fine with numbers and strings
2 odpowiedzi
+ 3
In most programming languages(including Java), = represents the assignment operator(it assigns a value to a variable) and == represents a comparison operator(it checks whether or not two values are them same).
0
Better search these questions before asking it here.
https://www.sololearn.com/discuss/175186/?ref=app
https://www.sololearn.com/discuss/1171728/?ref=app
https://www.sololearn.com/discuss/1084542/?ref=app