Hi ppl,
whenever we write
object gets created; assigning values to it is perfectly fine.
now in case of array objects:
i had assigned values to
by
..its syntactically right but giving run-time error of null pointer assignment.
Whenever we create an object of any class its a reference variable untill memory is assigned to it..
but we are clearly using new operator and allocating memory to each object in object array.....where am i mistaking?
whenever we write
Code:
class object=new class();
now in case of array objects:
Code:
class object[]=new class[3];
Code:
object[0]...3
Code:
object[0].variable
Whenever we create an object of any class its a reference variable untill memory is assigned to it..
but we are clearly using new operator and allocating memory to each object in object array.....where am i mistaking?
Comment