Confusion of reference variables and objects in arrays

Confusion of reference variables vs objects in arrays

Precaution in using reference variables vs objects in array creation Note: If you are new to reference variables, read Reference Variables Anonymous objects before reading this. Reference variables vs Objects is very confusing while creating array objects as an array. Observe the following code.

Demo d[] = new Demo[2];…