
2006年11月29日
<<Java Language Specification>>列出了java关键字、保留关键字,
并举例说明true,false和null都不是java的keywords,而是literals ,尽管他们看起来很像是keywords。
3.9 Keywords
The following character sequences, formed from ASCII letters, are reserved for use as keywords and cannot be used as identifiers (§3.8):
Keyword: one of
abstract default if private this
boolean do implements protected throw
break double import public throws
byte else instanceof return transient
case extends int short try
catch final interface static void
char finally long strictfp volatile
class float native super while
const for new switch
continue goto package synchronized
The keywords const and goto are reserved, even though they are not currently used. This may allow a Java compiler to produce better error messages if these C++ keywords incorrectly appear in programs.
While true and false might appear to be keywords, they are technically Boolean literals (§3.10.3). Similarly, while null might appear to be a keyword, it is technically the null literal (§3.10.7).
3.10 Literals
A literal is the source code representation of a value of a primitive type (§4.2), the String type (§4.3.3), or the null type (§4.1):
Literal:
IntegerLiteral
FloatingPointLiteral
BooleanLiteral
CharacterLiteral
StringLiteral
NullLiteral
posted @
2006-11-29 23:57 jinn 阅读(1018) |
评论 (0) |
编辑 收藏
软回车(Soft Return):软回车是在字处理程序中作为自动移行功能的一部分自动插入的,也叫换行符,在word中看不见。如果文本一行的长度超过文档所定义的右边距时,即当前行没有足够的空间放置下一个字符时,文字处理软件将在这一行文本的末尾自动插入一个软回车符,文本另起一行。这个软回车符是由编辑程序自动产生的,叫做软回车。当重新设置文档的右边距并做重新排版时,软回车出现的位置就会自动改变。
在网页中按Shift+Enter(回车键)为软回车。↓
硬回车(Hard Return):硬回车是段落标记,表示一个段落,也称回车符。硬回车是用户键入的回车符,它是实际插入正文的符号。它通常包括两个字符,即分别表示回车和换行。如果要在文本段落的末端换行或者在文本中增加空行,可按回车键。硬回车是文件的一部分,它不能自动消除,除非删除它。
按Enter(回车键)为硬回车。
简言之,软回车是字处理软件为了换行自动插入的,而硬回车是用户按Enter键键入的回车符,是实际插入正文的符号,是文件的一部分。
java转义字符:
\ddd 1到3位8进制数据所表示的字符(ddd)
\uxxxx 1到4位16进制数所表示的字符(xxxx)
\' 单引号字符
\\ 反斜杠字符
\r 回车
\n 换行
\f 走纸换页
\t 横向跳格
\b 退格
java中可以用两种方法表示硬回车:
一.\r\n
二.System.getProperty("line.separator")
posted @
2006-11-29 13:30 jinn 阅读(1968) |
评论 (2) |
编辑 收藏