Java关键字01

xiaoxiao2026-08-11  37

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:  

 

相关资源:Java关键字大全 Java关键字
转载请注明原文地址: https://www.6miu.com/read-5051052.html

最新回复(0)