Friday, July 31, 2009

Is it possible to declare an empty array in java?

Is it possible to declare an empty array in java?


So Object[] array = new Object[0] is possible?

Is it possible to declare an empty array in java?
Object[] array = null;





Object[] array = none;





Object[] array = never;
Reply:Yes. There is no reason why you cannot create an array with 0 elements.
Reply:You dont do that. You do this instead:





Object[] array = null;
Reply:Yes you can.





In this article, the author makes an interesting case for using zero arrays in Java.





http://www.javapractices.com/Topic59.cjp

video cards

No comments:

Post a Comment