What is the difference between NULL and zero ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

What is the difference between NULL and zero ??

Problem 236+java

28th Apr 2017, 11:25 AM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
6 Answers
+ 19
When an object reference variable is not initialized the variable is not pointing to an object. It is NULL. When an primitive numeric variable is not initialized its default value is zero.
29th Apr 2017, 4:50 AM
NimWing Yuan
NimWing Yuan - avatar
+ 9
Zero is a value. NULL means an absent value.
28th Apr 2017, 11:39 AM
visph
visph - avatar
+ 4
Zero is a defined int with value 0 NULL is a undefined variable contains no value.
28th Apr 2017, 11:40 AM
Calviղ
Calviղ - avatar
+ 4
NULL means UNDEFINED (dividing a/0 will give undefined) ZERO is an integer which means the number 0
28th Apr 2017, 12:49 PM
Siddharth Saraf
+ 3
NULL means no value as in "unassigned".  An object that is not instantiated should be NULL.  But in databases NULL means unassigned = no value  It is different from 0 which is a value that can be count
28th Apr 2017, 11:49 AM
黃冠融
黃冠融 - avatar
+ 3
Just like the difference between white and transparent. White is no color. Transparent is colorless.
28th Apr 2017, 11:54 AM
K.C. Leung
K.C. Leung - avatar