Why is there a distinction between logical and bitwise operators in Java and C#?
问题 Languages like i.e. Java and C# have both bitwise and logical operators. Logical operators make only sense with boolean operands, bitwise operators work with integer types as well. Since C had no boolean type and treats all non-zero integers as true, the existence of both logical and bitwise operators makes sense there. However, languages like Java or C# have a boolean type so the compiler could automatically use the right kind of operators, depending on the type context. So, is there some