字面量理解

字面量是你临时给定的 一个没有任何引用的值(包括基本数据类型和字符串)

常量是一个带引用的不可更改的值 你可以在程序的任何地方(当然只要是可访问到的地方)引用它

字面量不行 在你出现字面量的改行语句结束以后 这个字面量就无法被再次使用了

In programming, a value written exactly as it’s meant to be interpreted. In contrast, a variable is a name that can represent different values during the execution of the program. And a constant is a name that represents the same value throughout a program. But a literal is not a name — it is the value itself.
A literal can be a number, a character, or a string. For example, in the expression,
x = 3
x is a variable, and 3 is a literal.
—————————————————————————————————————————————————————
维基百科的解释是:In computer science, a literal is a notation for representing a fixed value in source code.
字面量就是用来描述源代码中固定值的表示法。
x = 3; //x是变量,3这个值就是字面量。

原文地址:https://www.cnblogs.com/549294286/p/3516510.html