可以在数字表达式中使用成对的圆括号来更改求值顺序或明确其含义。
在查看以下示例时,假定 intValue1 等于 1,intValue2 等于 2,依此类推,并且每个值都没有小数位:
/* == -8, with the parentheses overriding the usual precedence of * and + */ intValue2 * (intValue1 - 5) /* == -2, with a unary minus as the last operator */ intValue2 + -4 /* == 1.4, if the expression is assigned to an item with at least one decimal place. */ intValue7 / intValue5 /* == 2, which is a remainder expressed as an integer value */ intValue7 % intValue5
有关显示圆括号对加号(+)用法的影响的示例,请参阅表达式。
如果计算出来的中间值超过 128 位,则数字表达式可能会给出意外的结果。