wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Array" Watch "Array" New topic


Anne Saizan
Ranch Hand

Joined: May 07, 2011
Posts: 35
How to add new element of the array.
if i have
String[] shoppingCart = new String[20];
how to add the new element of the shopping cart?
Thanks you
Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

shoppingCart[1] = "books";
shoppingCart[2] = "games";


SCJP 6. Learning more now.
Anne Saizan
Ranch Hand

Joined: May 07, 2011
Posts: 35
thanks for the reply.
but, what I mean is.

Dawid Skrzypczynski
Ranch Hand

Joined: Jun 08, 2011
Posts: 52
Something like this ?

It is sorta covered in the JavaRanch Style Guide.
subject: Array
Similar Threads
String doubt
Proper way to remove and shift elements of an array
Finding number of a rows in a resultset...
Array of Vectors
Help Please