File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

plz help

jeyakanth yogaratnam

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

Joined: Jul 08, 2003
Posts: 24199


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

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
Node King

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

Here is the API:

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!
wood burning stoves
subject: plz help
It's not a secret anymore!