User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 456,518 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,812 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 1969 | Replies: 4
Reply
Join Date: Aug 2007
Location: Mauritius
Posts: 10
Reputation: Steven_C is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Steven_C Steven_C is offline Offline
Newbie Poster

Question need a sample code for ArrayList

  #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?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2007
Location: USA
Posts: 3,090
Reputation: Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold 
Rep Power: 15
Solved Threads: 307
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Posting Sensei

Re: need a sample code for ArrayList

  #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  
Join Date: Aug 2007
Location: Mauritius
Posts: 10
Reputation: Steven_C is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Steven_C Steven_C is offline Offline
Newbie Poster

Re: need a sample code for ArrayList

  #3  
Oct 3rd, 2007
okay thanks
I will read em
Reply With Quote  
Join Date: Oct 2007
Posts: 8
Reputation: awo is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
awo awo is offline Offline
Newbie Poster

Re: need a sample code for ArrayList

  #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  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 19
Solved Threads: 200
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: need a sample code for ArrayList

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 4:04 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC