I need to know if i store my data in an ArrayList and I need to get the value that I've stored in it
For example : if I have an array list like this
ArrayList A = new ArrayList();
A = {"Soad", "mahran"};
and I want to get each String element, 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]);
}
}
}