Search code examples
javaandroidmethodsparametersmethod-parameters

How exactly passing two integers to a method that accepts one integer works in JAVA ? ( Android )


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?


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.