Skip to content

Instantly share code, notes, and snippets.

@youngjinmo
Created September 17, 2019 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save youngjinmo/0fbc29b02c8b51856b34beca2b64398e to your computer and use it in GitHub Desktop.
Save youngjinmo/0fbc29b02c8b51856b34beca2b64398e to your computer and use it in GitHub Desktop.
문자열 배열을 문자형 배열로 변환하는 방법 (String ➡️ char[])
import java.util.Arrays;
public class string2charArr {
public static void main(String[] args) {
String data = "Hello World";
String[] strArr = data.split("");
char[] charArr = data.toCharArray();
System.out.println(Arrays.toString(strArr));
// [H, e, l, l, o, , W, o, r, l, d]
System.out.println(Arrays.toString(charArr));
// [H, e, l, l, o, , W, o, r, l, d]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment