Which method is more efficient?

Ads
 

Which method is more efficient?

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. [email protected]

View Answers

October 18, 2010 at 9:34 PM

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

Ads









Related Tutorials/Questions & Answers:
Which method is more efficient?
Example for a method in java which returns a class
Advertisements
Method which returns area of circle - Java Beginners
How to found which class or method contain specific annotation?
How to change the value of a variable which is set in jsp (by jstl method) by calling the function from js?
What is the equivalent method in Java which is equivalent to clrscr() in c/c++ . The code should help to clear the output screen ?
Given a list of scenarios, identify which will result in an ejbRemove method not being called on a bean instance.
JavaScript remove method
method
method
Method Overloading
Getting the method name used in the Application
JavaScript navigate method
JavaScript lastIndexOf method
Version of which>which dependency
JavaScript min method
Java method overloading
Dynamic method dispatch
Insert an object with the add(Object) method
which tags work on which browsers
SEND + MORE = MONEY
method name
more circles - Java Beginners
JavaScript array splice
UITableview show more
What is a native method?
Method
JavaScript insertData method
load more with jquery
pack() vs. setSize() Method in Java
method overloading

Ads