need a sample code for ArrayList

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2007
Posts: 12
Reputation: Steven_C is an unknown quantity at this point 
Solved Threads: 0
Steven_C Steven_C is offline Offline
Newbie Poster

need a sample code for ArrayList

 
0
  #1
Oct 3rd, 2007
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?
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,491
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 519
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: need a sample code for ArrayList

 
0
  #2
Oct 3rd, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 12
Reputation: Steven_C is an unknown quantity at this point 
Solved Threads: 0
Steven_C Steven_C is offline Offline
Newbie Poster

Re: need a sample code for ArrayList

 
0
  #3
Oct 3rd, 2007
okay thanks
I will read em
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 19
Reputation: awo is an unknown quantity at this point 
Solved Threads: 1
awo's Avatar
awo awo is offline Offline
Newbie Poster

Re: need a sample code for ArrayList

 
0
  #4
Oct 3rd, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: need a sample code for ArrayList

 
0
  #5
Oct 4th, 2007
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...).
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC