当前位置 : 主页 > 编程语言 > java >

转换数据的基本类型int >byte

来源:互联网 收集:自由互联 发布时间:2021-06-28
gistfile1.txt public class Example2_2 {public static void main(String[] args) {byte b=22;int n=129;float f=123456.6789f;double d=123456789.123456789;System.out.println("b= "+b);System.out.println("n= "+n);System.out.println("f= "+f);System.
gistfile1.txt
public class Example2_2 {

	public static void main(String[] args) {
		byte b=22;
		int n=129;
		float f=123456.6789f;
		double d=123456789.123456789;
		System.out.println("b= "+b);
		System.out.println("n= "+n);
		System.out.println("f= "+f);
		System.out.println("d= "+d);
		b =(byte)n;
		f=(float)d;
		System.out.println("b= "+b);
		System.out.println("f= "+f);
		
	}

}
网友评论