In Java, is there a null existing object on the heap?

In Java, is there a null existing object on the heap?

I am trying to understand the difference between an uninitialized local variable (which does not compile) and one initialized null (which compiles).

+3
source share
5 answers

Look here:

Java IAQ: Frequently Asked Questions: Is a null object?

+7
source

Or, to save the click, the answer is no, this is not an object. A value of null means that the object is not referenced.

+3
source

. , :

  • ; i .
  • i , " ".
  • i , null.
  • i 1, 4.

:

Integer i;
i = null;
i = Integer.valueOf(1);
i++;

:

, ?

; . , null, . Java. , .

: . - -, , deviant bytecode .

+3

, , , null. JVM, .

, , - . . , , .

0

Null . , , null. , null, . , , , .. . , - .

Java , . Java , , . , C, . Java : 0, 0.0, false null .., . .: -)

0

Source: https://habr.com/ru/post/1766477/


All Articles