What does null mean?

St.Antario

As I understood null is instance of T for all reference type T.

Question 1. What's defenition of null? How does null represents in memory?

Consider the following case: We defined class

public class MyClass{
    Integer i;
}

Now null can be cast to MyClass, but I don't explicitly define that.

Question 2. From what compiler will be know that null can be cast to MyClass?

Marko Topolnik

Formally, null is a singleton member of the null type, which is defined to be the subtype of every other Java type.

null is a reference type and its value is the only reference value which doesn't refer to any object. Therefore there is no representation of null in memory. The binary value of a reference-typed variable whose value is null is simply zero (all zero bits). Even though this is not explicitly specified, it follows from the general initialization semantics of objects and any other value would cause major problems to an implementation.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

What does "/dev/null" mean at the end of shell commands

What does null! statement mean?

Error java.lang.AssertionError: expected: null<null> but was: java.lang.String<null> what does it mean?

What does +? mean in regex?

What does Return myVar != null actually mean?

What does it mean to say that "null is a literal" in JavaScript?

What does the following mean as a type: () => void = null

What does "T =:= Int = null" mean in Scala?

What does poll(NULL, 0, timeout) mean?

What does 'null?', 'procedure?' and 'symbol?' mean in the following code?

Variable = null in method declaration? What does it mean and how is this method called?

What does "null" mean when passed as the provider to DateTime.TryParseExact?

What does really mean null string?

What does 2>/dev/null mean?

What does $PATH mean?

What does "< /dev/null" mean?

What does /dev/null mean in a shell script?

What does the null ? 0 and null ? null mean in android?

What does '>/dev/null 2>&1' mean in this article of crontab basics?

What does > /dev/null 2>&1 || true mean in Linux?

What does the parameter $something=null mean in PHP?

What does it mean when a C# function parameter contains `= null`?

What does A => A = a => a mean in scala

What does * mean in sql?

what does this "a: ?number = null;" mean?

What does it mean to check that a parameter is not null or empty nor negative?

what does this null pointer exception mean in my program?

What does "sound" mean in dart "sound null safety" feature?

What does "null!" default value of property mean?