Which method is more efficient?

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









Related Tutorials/Questions & Answers:
Which method is more efficient?
Which pays more computer science or software engineering?
Advertisements
Example for a method in java which returns a class
Method which returns area of circle - Java Beginners
Which are some good websites to learn more about Data Science?
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.
method
method
JavaScript remove method
Method Overloading
Getting the method name used in the Application
JavaScript navigate method
JavaScript lastIndexOf method
Dynamic method dispatch
JavaScript min method
Java method overloading
method name
Insert an object with the add(Object) method
Method
pack() vs. setSize() Method in Java
JavaScript insertData method
JavaScript array splice
Version of which>which dependency
method overloading
method overloading
_jspService() method
JavaScript createAttribute method
JavaScript applyElement method Example
JavaScript Focus method
method inside the method??
PHP set static Method
Remove a value with remove() method
What is a native method?
which tags work on which browsers
JavaScript focus method
method overloading
JavaScript reset() method
get method
PHP Invoke Method
method question
more circles - Java Beginners
Remote Method Invocation (RMI)
Insert an element with the add(int, Object) method
Method Overloading
Method Overloading
A method getColumnCount.
Insert an array list of objects with addAll(ArrayList) method

Ads