Java 中 null 是关键字吗

突然产生一个疑问:Javanull 是关键字吗?
于是我google了一下:
《Java 中 null 是关键字吗》
这些博客为什么都长一样暂且不讨论,就这个权重第一的答案我认为有问题。为了严谨些,在官方文档中寻求答案往往是最可靠的:1

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).

官方文档说了,人家只是看起来像,但是并不是,truefalse也不是,只是字面量。
附正经的关键字们:

abstract   continue   for          new         switch
assert     default    if           package     synchronized
boolean    do         goto         private     this
break      double     implements   protected   throw
byte       else       import       public      throws
case       enum       instanceof   return      transient
catch      extends    int          short       try
char       final      interface    static      void
class      finally    long         strictfp    volatile
const      float      native       super       while
  1. https://docs.oracle.com for JDK8 ↩︎

    原文作者:Logicr
    原文地址: https://blog.csdn.net/Logicr/article/details/114289710
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞