cooperok
0
Q:

convert string to array java

String a = "Hello World";

char[] a_char = a.toCharArray();
1
How to convert string to array

import java.util.*; 
  
public class GFG { 
  
    public static void main(String args[]) 
    { 
  
        String str = "GeeksForGeeks"; 
  
        // Creating array and Storing the array 
        // returned by toCharArray() 
        char[] ch = str.toCharArray(); 
  
        // Printing array 
        for (char c : ch) { 
            System.out.println(c); 
        } 
    } 
} 
1

New to Communities?

Join the community