Convert String Elements To Array Java Code Example


Example: how to convert string to array in java


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);
}
}
}

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable