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

530 Valid Hostname Is Expected When Setting Up IIS 10 For Multiple Sites

C Perror Example

Converting A String To Int In Groovy