Results 1 to 2 of 2
Thread: add method in arrays
- 03-14-2009, 11:45 AM #1
Senior Member
- Join Date
- Jan 2009
- Posts
- 119
- Rep Power
- 0
add method in arrays
I am having problem making a Grocery List.
At First I wanted to use an Array, though I ran into problem with the addd and remove command so I decided to use the Vector class.
I would love to use the array, if any one has an algorithm that works just like the one in the vector class that would be useful. Or Better yet tell me why this alogrith has a fault...
Java Code:static int index; GroceryItemOrder[] items; //Array of the item Object //The add method public void add(GroceryItemOrder item) { //if there are no items already if(index ==0) { items[index]= item; }else // if there are, save in next slot { items[index + 1] = item; } } //for the remove method I just decided to set the value to be removed to null.
- 03-14-2009, 11:58 AM #2
Senior Member
- Join Date
- Jan 2009
- Posts
- 119
- Rep Power
- 0
Similar Threads
-
method not abstract, does not override actionperformed method.
By Theman in forum New To JavaReplies: 2Last Post: 03-26-2010, 05:12 PM -
Help!! With arrays
By ookie833 in forum New To JavaReplies: 8Last Post: 12-14-2008, 12:57 AM -
2D Arrays
By Major90 in forum New To JavaReplies: 6Last Post: 11-06-2008, 02:08 PM -
Calling a method in a different class from within a method problem
By CirKuT in forum New To JavaReplies: 29Last Post: 09-25-2008, 07:55 PM -
cannot call private method from static method
By jon80 in forum New To JavaReplies: 3Last Post: 05-07-2008, 08:37 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks