diff --git a/day02/src/com/inmind/type_cast01/Demo05.java b/day02/src/com/inmind/type_cast01/Demo05.java new file mode 100644 index 0000000..1e0e1b0 --- /dev/null +++ b/day02/src/com/inmind/type_cast01/Demo05.java @@ -0,0 +1,17 @@ +package com.inmind.type_cast01; + +/* +数据转换--字符数据 +字符在数学运算中,是遵循ASCII码表,将对应码表中的字符对应的十进制的值参与运算 + + */ +public class Demo05 { + public static void main(String[] args) { + //定义一个字符变量 + char c = 'a';// a: 97 A:65 0:48 + int i = 10; + + int sum = i+c;//自动类型转换 + System.out.println(sum);//107 + } +}