首页 > 其他 > 详细

字面量理解

时间:2014-01-16 00:03:25      阅读:716      评论:0      收藏:0      [点我收藏+]

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

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

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

 

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这个值就是字面量。

字面量理解

原文:http://www.cnblogs.com/549294286/p/3516510.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!