Hi
you can follow this apprach
String[] sArray = new String[10];
for (int i = 0; i < 10;i++) {
sArray[i] = new String("apple") ;
}
--- Arun Thomas <[EMAIL PROTECTED]> wrote:
> There have been several responses that mentioned
> using a specific length
> for the Array when instantiating the new Array. If
> you don't know the
> expected
> length, you can do something like:
>
> List l = new ArrayList();
> for (int i = 0; i < <someLength>;i++) {
> l.add("<aString>");
> }
> String[] sArray = l.toArray(new String[0]);
>
> > -----Original Message-----
> > From: A mailing list about Java Server Pages
> specification and reference
> > [mailto:[EMAIL PROTECTED]]On Behalf Of
> Liza J Alenchery
> > Sent: Tuesday, May 30, 2000 1:25 PM
> > To: [EMAIL PROTECTED]
> > Subject: Add string to string array.
> >
> >
> > How can I create an array of strings and assign a
> new string to the
> > array in a loop?
> >
> > String[] sArray ;
> > for (int i = 0; i < 10;i++) {
> > sArray[i] = "apple" ;
> >
> > }
> >
> > The code fragment above does not work. But this is
> what I need to do.
> > Add strings to a string array at runtime.
> >
> > thanks in advance
> > liza
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Kick off your party with Yahoo! Invites.
> > http://invites.yahoo.com/
> >
> >
>
==================================================================
> > =========
> > To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff
> > JSP-INTEREST".
> > 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
> >
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> 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
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
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