Hi Guys, i'm new to java and i need a code like a student form or employee on how to add, search, and delete a data in an array or list.. i'm very confused and i really need your help.. thanks.
I recommened you to try with your self and then If you have a compilation error or any problem post it here
To create an array use the following general syntax:
dataType arrayName = new dataType[arraySize]; Accessing Size:
arr.length Accessing Data:
arr[index] Modifying Data:
arr[index] = var Insertion: Not Applicable
Deletion: Not Applicable
To create an ArrayList use the following general syntax:
ArrayList<DataType> arrayName = new ArrayList<DataType>(); Accessing Size:
arr.size() Accessing Data:
arr.get(index) Modifying Data:
arr.add(val) if you want to add it to the end.
Notes on ArrayLists:
1. You must import java.util.ArrayList before using them.
2. If you remove a value from an ArrayList, the values later in the list will move up to fill the gap. If you insert a value into an ArrayList, the value there and the values after it will move down to make room.