Java_自动类型转换

public class DataType3
{
	public static void main(String args[])
	{
		/**
		*自动类型转换:从存储范围小的数据类型到存储范围大的数据类型。
		*byte->short->int->long->float->double
		*/
		byte a = 127;
		short b = a;
		int c = b;
		long d = c;
		float e = d;
		double f = 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_自动类型转换)