【Java开源代码栏目提醒】:网学会员为需要Java开源代码的朋友们搜集整理了ZiZENGJian2.java相关资料,希望对各位网友有所帮助!
package Chapter2;
public class ZiZENGJian2 {
public static void main(String[] args) {
byte b1=5; //定义一个byte类型的变量
byte b2=(byte)(b1+1); //进行强制类型转换
System.out.println("使用加运算符的结果是"+b2);
byte b3=5; //定义一个byte类型的变量
byte b4=++b3; //进行自增运算,不需要类型转换
System.out.println("使用自增运算符的结果是"+b4);
}
}