Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (10.2k points)

I tried searching using Google Search and Stack Overflow, but it didn't show up any results. I have seen this in opensource library code:

Notification notification = new Notification(icon, tickerText, when);

notification.defaults |= Notification.DEFAULT_SOUND;

notification.defaults |= Notification.DEFAULT_VIBRATE;

What does "|=" ( pipe equal operator ) mean?

1 Answer

0 votes
by (46k points)

It's a shortening for this:

notification.defaults = notification.defaults | Notification.DEFAULT_SOUND;

And | is a bit-wise OR.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Aug 18, 2019 in Java by Nigam (4k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...