在看java语言规范中文第三版时遇到一个讲解自增运算符中类型转换的翻译不明的问题
明月镇魂 2016-01-30 10:50:19 其中在讲前缀增量运算符++时,有这么一段话
前面有一个++运算符的一元表达式是前缀增量表达式。一元表达式的结果必须可转换(5.1.8节)到数值类型的类型的变量,否则,会编译报错。前缀增量表达式的类型是变量的类型,前缀增量表达式的类型是变量的类型。前缀增量表达式的结果不是一个变量,而是一个值。
标红的那段话就是我不明白的地方,能否讲解一下,这句话表达的意思是什么?英文原句如下:
A unary expression preceded by a ++ operator is a prefix increment expression.
The result of the unary expression must be a variable of a type that is convertible
(5.1.8) to a numeric type, or a compile-time error occurs. The type of the prefix
increment expression is the type of the variable. The result of the prefix increment
expression is not a variable, but a value.