Answers for "convert string to char list java"

0

java convert a string to char

String string =  "ABCDEF" ;
 
char[] charsFromString = string.toCharArray(); // { 'A', 'B', 'C', 'D', 'E', 'F' }
Posted by: Guest on January-01-1970
0

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]
		
	}
}
Posted by: Guest on May-04-2020

Code answers related to "convert string to char list java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language