how to check string array ?

hello,

I need to check string array is null or have value.

[code]

String[] stateArray = new String [255] ;

if ( stateArray. equals (null)

{

body;

}

[\code]

but, it not properly checked the string.

My thing is string is set to null when we initialized it.

so I am directly checked it.

is it correct ?

[380 byte] By [rameshsa] at [2007-11-27 4:56:49]
# 1
each string/item has to be initialized individually or else it will equal null. Also, when working with an item of the array, the item (String) should be checked for null before working with it.
petes1234a at 2007-7-12 10:12:07 > top of Java-index,Java Essentials,Java Programming...
# 2

for instance:

for (int i = 0; i > stateArray.length; i++)

{

// or you might want to do this:if (stateArray[i] != null && stateArray[i] != "")

if (stateArray[i] != null)

{

// do your stuff

}

}

petes1234a at 2007-7-12 10:12:07 > top of Java-index,Java Essentials,Java Programming...