> Hi
> i have intialized an Object[] a;
> i tried to enter an integer in to object
> a[0] = 12;
> but i was not able to do so...
> how can we do this...
First, you do not have an Object, you have an array of Objects.
Second, an int is a primitive an can not be directly referenced by an Object variable. You can wrap the primitive in its appropriate wrapper class and reference that object.
Object a;
a = new Integer(12);
Note: I was ignoring the autoboxing feature that BIJ001mentioned.
Message was edited by:
jbish