Possible Duplicate:
Java Arrays - length
How do you determine the length of an array that is not an String array or an integer array? It won't let me use .length(), but only .length? 
Why and is there another way of determining this?
You can use getLength method from java.lang.reflect.Array, which uses reflection (so it'll be slow):
Object[] anArray = new Object[2];
int length = Array.getLength(anArray);
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With