The Artima Developer Community
Sponsored Link

Java Answers Forum
Removing an object from an array

2 replies on 1 page. Most recent reply: May 17, 2003 4:38 AM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Kevin

Posts: 27
Nickname: quasi
Registered: Apr, 2003

Removing an object from an array Posted: May 15, 2003 11:44 PM
Reply to this message Reply
Advertisement
How do I remove an object from an array.
i.e if I have an array of loans
loan[1]=(.....)
loan[2]=(.....)

etc
how do I remove a loan from the array


Abel Perez

Posts: 3
Nickname: abel
Registered: May, 2003

Re: Removing an object from an array Posted: May 16, 2003 12:59 AM
Reply to this message Reply
Hi,

If you want to simple use the loan in the array then you can do this:
loan l = loan[1];

If you want to completly remove the loan from the array then you can do this:
loan[1] = null;

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Removing an object from an array Posted: May 17, 2003 4:38 AM
Reply to this message Reply
I have some code posted at:
http://www.quantumhyperspace.com/SourceBank/ArrayPlay.java
which has array element operations with an int[] array.

You could do the same thing with an object array such as loan[].

Flat View: This topic has 2 replies on 1 page
Topic: Ant execution Previous Topic   Next Topic Topic: creating a  application to help user to record and organise a list of tasks

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use