2D arrays : "Arrays are objects"

In the video, we are told that arrays are objects and thus their default value is NULL. This statement is contradictory for 1D arrays as there arrays are objects but they hold 0 as default value.

Hi Aanchal,
When you just declare an integer array i.e.
int[] arr;
in the above statement arr is an integer array and compiler will assign a null value to it.
But when you intialize it with new keyword i.e.
int[] arr = new int[length];
the compiler will assign a continuous block of memory of size equal to lenght*4 bytes as one integer takes 4 bytes and in this every 4 byte block will store 0 by default.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.