Ask a Question

0 errors found:

0
0
tags
 
 

Possible matches

We think your question may have already been asked. Here are a few questions that we think are similar matches.

These are not the same, ask my question. 

close

Latest Questionsrss
Questions Popular Activity

  • Sreenidhi Sreesha

    1

    What is the diff btw a null reference and a reference to an empty object?

    What do u mean by empty object?

    Answered by Sreenidhi Sreesha - 6 months ago

     
  • Garuto

    1
  • Sreenidhi Sreesha

    1

    Is null an Object?

    Is null an object?

    Answer:

    Absolutely not.
    By that, I mean (null instanceof Object) is
    false.  Some other things you should know about null:

    You can't call a method on null: X.m() is an error when
    x is null and m is a non-static method.
    (When m is a static method it is fine,
    because it is the class of x that matters; the value is ignored.)

    There is only one null, not one for each class.  Thus,
    ((String) null == (Hashtable) null), for example.

    It is ok to pass null as an argument to a method, as long as the
    method is expecting it.  Some methods do; some do not.  So, for
    example, System.out.println(null) is ok, but
    string.compareTo(null) is not. For methods you write, your javadoc
    comments should say whether null is ok, unless it is obvious.

    In JDK 1.1 to 1.1.5, passing null as the literal argument
    to a constructor of an anonymous inner class (e.g., new
    SomeClass(null) { ...} caused a compiler error.  It's ok to pass
    an expression whose value is null, or to pass a coerced null, like
    new SomeClass((String) null) { ...}

    There are at least three different meanings that null is commonly used
    to
    express:
    Uninitialized. A variable or slot that hasn't yet been assigned its
    real value.

    Non-existant/not applicable.  For example, terminal nodes in a
    binary tree might be represented by a regular node with null child
    pointers.

    Empty. For example, you might use null to represent the empty
    tree.  Note that this is subtly different from the previous case,
    although some people make the mistake of confusing the two cases.  The
    difference is whether null is an acceptable tree node, or whether it
    is a signal to not treat the value as a tree node.  Compare the
    following three implementations of binary tree nodes with an in-order print method:
    Source:www.javafaq.nu

    Answered by Sreenidhi Sreesha - 6 months ago

     
  • Sreenidhi Sreesha

    1

    Is null an Object?

    Asked by Sreenidhi Sreesha - 6 months ago java null object