Is null a Java keyword?

2019-01-24 09:19发布

Is null is a keyword in Java?

9条回答
Viruses.
2楼-- · 2019-01-24 09:47

No. null is not a keyword in Java.

查看更多
萌系小妹纸
3楼-- · 2019-01-24 09:50

No.It is not a keyword.

查看更多
看我几分像从前
4楼-- · 2019-01-24 09:51

null is a literal, in the same sense that false, 10, and '\n' are literals. It's not a "keyword", technically, but it is a character string that is treated specially by the compiler if the compiler encounters it in a java source file.

So, no, you cannot name a variable "null". The lexical analyzer will decide that it is not an identifier.

查看更多
登录 后发表回答