my dog learned polymorphism*
The moose likes Java in General and the fly likes plz help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "plz help" Watch "plz help" New topic
Author

plz help

jeyakanth yogaratnam
Greenhorn

Joined: Jun 25, 2005
Posts: 9
i want to know hw to update or delete records from a array.if u have the code plz send me it is urgent.thanks
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi,

Welcome to JavaRanch!

An array of...?

Depending on your needs, this could be as simple as assigning a new value, or null, to an array element; or it might involve copying higher-number elements down to fill up a "hole" left by a deleted element. Can you describe your requirements in a bit more detail?


[Jess in Action][AskingGoodQuestions]
jeyakanth yogaratnam
Greenhorn

Joined: Jun 25, 2005
Posts: 9
well it is like this that i want ot create an array of objects and store data in it. and after that i want to update that record and amle to delete it as well. this is my problem. i am able to add records but don't knoew to update or to delete it. if u can help me it will be a big help.

thank you
jeyakanth
Node King
Greenhorn

Joined: Oct 14, 2005
Posts: 3
Try using an ArrayList:

Here is the API:
http://java.sun.com/j2se/1.3/docs/api/java/util/ArrayList.html

You can use those methods to remove Objects. Don't forget to import java.util.ArrayList!

Oh, and failing that, my advice is to replace the old array with a brand new array one place smaller and without the data you wished to delete. Copy all the elements across using a while or for loop.

If you need more help let us know.


A really good Java book which tells you in very concise instructions how to do things?<br /> <br />Java in Easy Steps - everything I ask you will just be filling in the gaps!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: plz help