Java_强制类型转换

class DataType4
{
	public static void main(String args[])
	{
		/**
		*强制类型转换
		*/
		double a = 127.0;
		float b = (float)a;
		long c = (long)b;
		int d = (int)c;
		short e = (short)d;
		byte f = (byte)e;

		System.out.println("a = " + a);
		System.out.println("b = " + b);
		System.out.println("c = " + c);
		System.out.println("d = " + d);
		System.out.println("e = " + e);
		System.out.println("f = " + f);
	}
}

你可能感兴趣的:(Java_强制类型转换)