0

is there a difference betweena | (b & c) AND a || (b&c)

in java?

when i tried it gave the same results. are they the same ?

elGreato
  • 140
  • 1
  • 14

1 Answers1

2

a || b never evaluates b if a evaluates to true.

Maroun
  • 94,125
  • 30
  • 188
  • 241
OPK
  • 4,120
  • 6
  • 36
  • 66
  • 1
    though this is true, you didn't point out the difference between the two. – Stultuske Dec 28 '15 at 14:11
  • @Stultuske Addresses the question in the title.. though explanation on the expression in question would be good too. – Aaditya Gavandalkar Dec 28 '15 at 14:14
  • @AadityaGavandalkar : if he had mentioned that in case of | the second part would be evaluated whether the first was true or false, yes, but he forgot to mention that part. He mentioned a fact, he didn't say what the difference with the | operator was. – Stultuske Dec 28 '15 at 14:20