区别1、& 和 | 可用于bitwise operation,即二进制运算,而&&和 || 不可以。
区别2、在逻辑运算时,&& 和 || 叫做short-circuit logical operator, 意思是先判定左侧的逻辑值,如果可以决定结果则不再浪费时间去判定右侧的逻辑值。
例如(2<3) || (a*5+b/3-c>5),因为(2<3)是true,无论右侧是true or false,结果都是true,所以右侧将不再进行判定。而& 和 | 则总会对两侧进行判定,称为non-short-circuit logical operator。