0 votes
1 view
in Java by (8.5k 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 (42.1k points)

It's a shortening for this:

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

And | is a bit-wise OR.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !