vendredi 23 septembre 2016

How condition statements act in Java

I have these lines of code

if (busted == true)
{
  return false;
}
else
{
  return true;
}

These lines of code compare if busted is true and return the boolean value. But when I change from

(busted == true) 

to

(busted = true)

it always change the value of busted to true. I don't understand why. It is just a condition inside the if-statement but how can it change the value of busted to true ?

Aucun commentaire:

Enregistrer un commentaire