How to create an Array of Object
Is this correct:Object[] anArray = new Object[5]; Thanks.
[91 byte] By [
jw2001] at [2007-9-26 2:43:00]

Well, you could actually try it to find out :P) but yes, that's correct--at least it's correct if what you want is an array of 5 Objects.
jverd at 2007-6-29 10:21:01 >

Your code will create an array of 5 null references to class Object. After that line you could code:anArray[0] = new Integer(5);
- or -
Object x = anArray[1];
but if you code:anArray[3].DoSomething();
and have not initialized anArray[3], you will get a NullPointerException.
Doug