Question

Please see Amitku 's answer on: Set inputType for an EditText?

Can anyone explain me how passing an (int | int) works for a method that accepts an (int) ?

Thank you.

Edit after answers:

But when you pass only one of the parameters, the method does not work as expected? So what exactly is going in there if we are passing only one of the integers?

Was it helpful?

Solution

The | is the "bitwise inclusive OR" operator, read more about it in the Java Docs.

You can see a few tables on how bitwise operators work here.

OTHER TIPS

Only one int is being passed. | is an infix operator that returns the bitwise-or of its arguments.

It's actually only one int as the int | int is a bitwise OR resulting in a single int.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top