posts - 11,  comments - 14,  trackbacks - 0

<<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 on 2006-11-29 23:57 jinn 阅读(2170) 评论(0)  编辑  收藏 所属分类: Java/j2se

只有注册用户登录后才能发表评论。


网站导航:
 
<2006年11月>
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

常用链接

留言簿(3)

随笔分类

文章分类

相册

网站链接

搜索

  •  

最新评论

阅读排行榜

评论排行榜