gpt4 book ai didi

java - & 和 && 和有什么不一样?

转载 作者:搜寻专家 更新时间:2023-11-01 02:15:04 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
& vs && and | vs ||

&&&有什么区别?

&&& 的输出相同。

例如:

  1. &&:

    if (true && true){
    System.out.println("------if------");
    } else {
    System.out.println("------else------");
    }
  2. &:

    if (true & true){
    System.out.println("------if------");
    } else {
    System.out.println("------else------");
    }

输出:

  1. ------if--------
  2. ------if--------

我们可以在代码中互换使用 &&& 运算符吗?

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