null 是个什么东西?? 是常量?? 关键字?? 谢谢!!把null看成个对象,System.out.printf(null);不行么?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 null是关键字是肯定的了。其实我觉得你可以把null看成是一个带有字符串色彩的常量。 NULL 不是对象,只是个关键字。表示未初始化的,无值的。 null就是无 在java中它是关键字 某种程度上可以理解为对象 因为可以赋予object reference 表示引用为空但不是对象 不符合对象特征 这样使用null会输出NullPointerException An identifier cannot have the same spelling (Unicode character sequence) as a keyword, boolean literal, or the null literal.(Excerpt from: http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.8)The null type has one value, the null reference, represented by the literal null, which is formed from ASCII characters. A null literal is always of the null type.(Excerpt from: http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#230717)首先,null 不是关键词;其次,null 有一个值,即空引用Java 中方法的传值方式基本上是按引用来传递,代码中传入 null 时,其引用的对象为空,所以会出空指针错误。 多谢火龙果 长见识了 有空要细读这些文档null非关键字 是和Identifiers Keywords, boolean literals等并列的null literal 恩.java中null,false,true这些是常量,不是关键字.但也不能用它们创建标识符对编译器来说,null是一个值.null值指引用变量没有引用堆上的任何对象. 它没toString()方法 所以直接print不起来 关于java中的逻辑运算符问题 请求一个在jframe里面的演示问题 swing的刷新问题 getAttribute? 小菜发问!!关于Canvas ,,, paint() 请高手指点,我是新手 菜鸟的几个问题 关于ILOG的应用的一个错误,请高手帮忙分析原因,感激不尽,一定重谢 各位高人请快来帮忙啊! 在java中如何判断当前主机的操作系统是UNIX或WINDOWS tomcat6 shtml 有关java.lang.reflect.Proxy 应用的问题
但不是对象 不符合对象特征
这样使用null会输出NullPointerException
(Excerpt from: http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.8)The null type has one value, the null reference, represented by the literal null, which is formed from ASCII characters. A null literal is always of the null type.
(Excerpt from: http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#230717)首先,null 不是关键词;
其次,null 有一个值,即空引用Java 中方法的传值方式基本上是按引用来传递,代码中传入 null 时,其引用的对象为空,所以会出空指针错误。
null非关键字 是和Identifiers Keywords, boolean literals等并列的null literal
对编译器来说,null是一个值.null值指引用变量没有引用堆上的任何对象.