三元表达
condition ? when-true : when-false
是一个 表达式 ,而不是一个语句,因此不能在需要语句的地方使用。
您可以这样写:
msi1.put(s1, (i1 == null) ? i1 : i1 + 1);
因为这是一个声明。

三元表达
condition ? when-true : when-false
是一个 表达式 ,而不是一个语句,因此不能在需要语句的地方使用。
您可以这样写:
msi1.put(s1, (i1 == null) ? i1 : i1 + 1);
因为这是一个声明。