944,128 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 5577
  • Java RSS
Oct 3rd, 2007
0

need a sample code for ArrayList

Expand Post »
Hi all, I am want to know how an array looks like and I need a sample code. Basically i want to know how to add, delete and edit records using an Arraylist.
Can anybody help please?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Steven_C is offline Offline
12 posts
since Aug 2007
Oct 3rd, 2007
0

Re: need a sample code for ArrayList

Just read the API for ArrayList. The methods are quite clear. If you don't understand Collections at all, there is a lot of info here: Java Collections Framework
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 839
Posting Genius
Ezzaral is offline Offline
6,761 posts
since May 2007
Oct 3rd, 2007
0

Re: need a sample code for ArrayList

okay thanks
I will read em
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Steven_C is offline Offline
12 posts
since Aug 2007
Oct 3rd, 2007
0

Re: need a sample code for ArrayList

before you move to the API i guess you need to really get a hold on what an array is, if i may put it in any way an array is just a contiguous memory for similar data types and almost all programming languages support array in java you have to declear an array using the SYNTAX;

datatype [] objectname;

where datatype may be any of the primitve data types or an object,

eg;

int [] x;
String [] name;

the next thing is for you to initilize the size of the array after which these is done with the syntax

objectname= new [integer_value_of size];
eg.

x= new int[10];
name= new String [25];

you can now assing a value to each index in the array

x[0]=34;
x[1]=45;
x[2]=19;
x[3]=49;
x[4]=38;

NOTE :-the index goes from 0 to n-1, n which is the size of the array itself can not be used
awo
Reputation Points: 10
Solved Threads: 1
Newbie Poster
awo is offline Offline
21 posts
since Oct 2007
Oct 4th, 2007
0

Re: need a sample code for ArrayList

if you don't understand the question, don't try to answer. Array != ArrayList as you would have known had you read the documentation (but then, you tell people they shouldn't read the documentation and you clearly have followed your own advise...).
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: hi i need coding of this question can any body help me
Next Thread in Java Forum Timeline: password authentication





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC