I'm faced with initializing a bunch of text fields in java. The problem is that the number of text fields is quite large, so i thought of putting them into an array and using a loop to initialize them. I want to know if this is better than using several lines to initialize all the text fields.
Samuel A. elimence@gmail.com
Hi,
May be you can initialize an array using following code:
//initialization String Arrays String arr[] = {"Zero", "One", "Three"}; for (int i = 0; i < arr.length; i++) { String s = (String) arr[i]; //Then use it }
and the use in for(..) loop.
Thanks