Created
September 17, 2019 15:33
-
-
Save youngjinmo/0fbc29b02c8b51856b34beca2b64398e to your computer and use it in GitHub Desktop.
문자열 배열을 문자형 배열로 변환하는 방법 (String ➡️ char[])
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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