谢谢!!把null看成个对象,System.out.printf(null);不行么??

解决方案 »

  1.   

    null是关键字是肯定的了。其实我觉得你可以把null看成是一个带有字符串色彩的常量。
      

  2.   

    NULL 不是对象,只是个关键字。表示未初始化的,无值的。
      

  3.   

    null就是无 在java中它是关键字 某种程度上可以理解为对象 因为可以赋予object reference 表示引用为空
    但不是对象 不符合对象特征 
    这样使用null会输出NullPointerException
      

  4.   

    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 时,其引用的对象为空,所以会出空指针错误。
      

  5.   

    多谢火龙果 长见识了 有空要细读这些文档
    null非关键字 是和Identifiers Keywords, boolean literals等并列的null literal
      

  6.   

    恩.java中null,false,true这些是常量,不是关键字.但也不能用它们创建标识符
    对编译器来说,null是一个值.null值指引用变量没有引用堆上的任何对象.
      

  7.   

    它没toString()方法 所以直接print不起来