JAVA类型转换

public class dsfa {
	public static void main(String[] args) {
		// TODO 自动生成的方法存根
		byte b=22;
		int n=129;
		float f=123456.6789f;
		double d=123456789.12345;
		System.out.println("b= " +b);
		System.out.println("n= " +n);
		System.out.println("f= " +f);
		System.out.println("d= " +d);
		
		//类型转换
		float x=10;
		int y=(int)34.8954;
		long z=(long)54.3342;
		byte a=(byte)12;
		byte b1=(byte)(-12);
		System.out.println("x= "  +x);
		System.out.println("y= "  +y);
		System.out.println("z= "  +z);
		System.out.println("a= "  +a);
		System.out.println("b1= "  +b1);
		
		

	}
}

你可能感兴趣的:(JAVA类型转换)