saving string characters into list java code example
Example: saving String character in arraylist
//storing String character in arraylist
import java.util.*;
public class Basic_Practice2 {
public static void main(String[] args) {
String s = "Hello";
ArrayList<String> al = new ArrayList<String>();
//storing String character in arraylist
for(int i = 0; i < s.length(); i++)
{
al.add(Character.toString(s.charAt(i)));
}
// printing ArrayList
System.out.println(al);//[H,e,l,l,o]
}
}