split string to list of chars java code example

Example 1: split every character in string into array java

String s="abcd";
char[] a=s.toCharArray();

Example 2: 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]
		
	}
}