`
hbkh2000
  • 浏览: 197776 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Java关键字01

阅读更多

Java关键字(keywords)

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

以上是java specifications中定义的keywords,一共48个,其中常见的三个看似是关键字的true, false, null,都不是关键字,而是作为一个单独标识类型。
其中,不常用到的关键字有:const,goto,native,strictfp,transient,volatile。
constgoto为java中的保留字。
1. native
native是方法修饰符。Native方法是由另外一种语言(如c/c++,FORTRAN,汇编)实现的本地方法。因为在外部实现了方法,所以在java代码中,就不需要声明了,有点类似于借口方法。Native可以和其他一些修饰符连用,但是abstract方法和Interface方法不能用native来修饰。
Example:  

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics