Transition between different variable types
This is one of the most important parts in Java. Keep concentrating and Memorize it.
String str = "3";//문자열 3
System.out.println('3'-'');//숫자 3
System.out.println('3'-'' + 1);//'3' - '0' 은 숫자3이므로 +1 = 4
//문자열 메소드 charAt()으로 문자열3을 문자3으로 바꾼다.
System.out.println(str.charAt(0) - '0');//"3"->'3', '3' - '0' = 3(숫자)System.out.println(3 + '0');
//'3'(문자)를 출력하고자 한다
System.out.println((char)(3 + '0'));//'3'(문자)3 + "" = "3", "3" - "" = 3
"3" + 1 = "3" + "1" = 31("3""1")Last updated