how to use an array list ?
- by soad El-hayek
salam 3lekom
i need to know if i store my data in an Araaylist and i need to get the value that i've stroed in it
for example : if i've an array list like this
ArrayList A = new ArrayList();
A = {"Soad", "mahran"};
and i want to get each String lonly how can i do it ?
I've tried to do it like this
package arraylist;
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
ArrayList S = new ArrayList();
String A = "soad ";
S.add(A);
S.add("A");
String F = S.toString();
System.out.println(F);
String [] W = F.split(",");
for(int i=0 ; i<W.length ; i++) {
System.out.println(W[i]);
}
}
}