How can I use the Java operator “|” in kotlin?

How do I use this operator?

int a = 5 | 10;
int b = 5 & 10;

It can be used in Java, but you can't see it in kotlin

Solution

You have named them features

Directly from kotlin docs

For example:

val x = (1 shl 2) and 0x000FF000
shl(bits) – signed shift left (Java's <<)
shr(bits) – signed shift right (Java's >>)
ushr(bits) – unsigned shift right (Java's >>>)
and(bits) – bitwise and
or(bits) – bitwise or
xor(bits) – bitwise xor
inv() – bitwise inversion
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>