gpt4 book ai didi

java - ~ 和 ! 和有什么不一样?运算符(operator)?

转载 作者:行者123 更新时间:2023-12-02 10:47:06 24 4
gpt4 key购买 nike

请告诉我 ~ 和 ! 之间的区别java中的运算符。

最佳答案

~bitwise complement operator :

The unary bitwise complement operator "~" inverts a bit pattern; it can be applied to any of the integral types, making every "0" a "1" and every "1" a "0". For example, a byte contains 8 bits; applying this operator to a value whose bit pattern is "00000000" would change its pattern to "11111111".

!logical complement operator 。它反转 boolean 值。

关于java - ~ 和 ! 和有什么不一样?运算符(operator)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1692839/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com