这是理解运算符优先级的重要性的一个示例。
您需要括号,否则解释如下:
String test = ("test" + testInteger) == null ? "(null)" : testInteger.toString();有关运算符及其优先级的列表,请参见此处。另请注意该页面顶部的警告:
注意:甚至有可能混淆时,请使用显式括号。

这是理解运算符优先级的重要性的一个示例。
您需要括号,否则解释如下:
String test = ("test" + testInteger) == null ? "(null)" : testInteger.toString();有关运算符及其优先级的列表,请参见此处。另请注意该页面顶部的警告:
注意:甚至有可能混淆时,请使用显式括号。