Skip to content

Instantly share code, notes, and snippets.

@youngjinmo
Last active September 14, 2019 13:55
Show Gist options
  • Save youngjinmo/0ba974c2f18d7f7c8baae9d3c4bf1d22 to your computer and use it in GitHub Desktop.
Save youngjinmo/0ba974c2f18d7f7c8baae9d3c4bf1d22 to your computer and use it in GitHub Desktop.
char형으로 형변환하는 방법
public class toChar {
public static void main(String[] args){
int a = 66;
double b = 3.456;
String c = "90";
char d = 'd';
System.out.println("Integer to char : " + (char)a);
// Integer to char : B
System.out.println("String to char : " + c.charAt(0)+", "+c.charAt(1));
// String to char : 9, 0
System.out.println("String to char Array : " + Arrays.toString(c.toCharArray()));
// String to char Array : [9, 0]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment