3 ms·
Most languages do. Java will always initialise a non-initialised value to NULL for instance (EDIT or 0 or false for primitives). It's simply a reality of how c
by rusk 8y ago
Most languages do. Java will always initialise a non-initialised value to NULL for instance (EDIT or 0 or false for primitives).
It's simply a reality of how computers operate that when you allocate a piece of memory (a variable) it will have something in it that you'll need to clear or initialise.
In this respect, NULL is doing you a favour.
- zxczxc111 8y agoOnly for field variables. Local variables most definitely have to be initialised by the programmer, otherwise it's a compiler error