Hi,

I am having a basic object reference question. Consider the following
code snippet:
      while (rootRs.next())
      {

categories.addElement(getCategory(rootRs.getString("cat_id")));
      }

Another code snippet:
     String catID = "";
      while (rootRs.next())
      {
           catID = rootRs.getString("cat_id");
           categories.addElement(getCategory(catID));
      }

Now my question is which one is better?  When we say
    categories.addElement(getCategory(rootRs.getString("cat_id")));

then we are getting a reference to the resultset string object or its
new object. If its a new String object, then the while loop will be
creating n no of objects throughout the loop!!!

Awaiting your feedback.

Thanks. in advance.

Sushil

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to