文章介绍
1、完善项目结构
1.1 新建第二章对应模块Chapter02
1.2 新建模块Chapter02对应包com.itheima
1.3 在包com.itheima下新建class类 ,类名称Example01.java
项目结构如下:
2、编写Example01.java代码 P38
package com.itheima;public class Example01 {public static void main(String[] args) {int num = 4;byte b = num;System.out.println(b);}
}
查看代码报错原因
3、修改Example01.java代码 使其强制转换不报错
package com.itheima;public class Example01 {public static void main(String[] args) {int num = 4;byte b = (byte) num;System.out.println(b);}
}