-8

Possible Duplicate:
Java Operators : |= bitwise OR and assign example

boolean bAlive;

bAlive |= this.properties.containsKey(name);

In the above , the code uses '|'. Why using '|' ?

Thanks in advance.

Community
  • 1
  • 1
tom
  • 45
  • 6

1 Answers1

5

The boolean is being OR'ed with the value on the right.

If this.properties.containsKey(name) is TRUE, then bAlive is set to TRUE.

Otherwise, bAlive remains the same.

Cloud
  • 18,753
  • 15
  • 79
  • 153