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?

Recommended Answers

All 4 Replies

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

okay thanks :)
I will read em

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,


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];

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

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


NOTE :-the index goes from 0 to n-1, n which is the size of the array itself can not be used

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...).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.