I have been programming in java for a while but I have not met a strange expression
int kk = 2 | 3;
What does ‘|’ mean in this expression? It seems hard to Google it.
I met it in source
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
Why we need to use this?
It’s a bitwise or – each result bit will be set if either or both inputs have a bit set in that position. 2 is 10 in binary, 3 is 11, so the result will also be 3.