0

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?

4
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by jwenting
0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.