(4)java的数据类型

package my;
public class J {
	public static void main(String[] args) {
		System.out.println("-----------整形数据类型-----------------");
		byte  B1 = -128,       B2 = 127;
		short S1 = -32768,     S2 = 32767;
		int   I1 = -2147483648,I2 = 2147483647;
		long  L1 = -462447716L,L2 = 4556824L;
		System.out.println("byte长度:"+B1+" ~ "+B2);
		System.out.println("short长度:"+S1+" ~ "+S2);
		System.out.println("int长度:"+I1+" ~ "+I2);
		System.out.println("long长度:"+L1+" ~ "+L2);
		System.out.println("-----------浮点数数据类型-----------------");
		float F1 = -5.264f,F2 = 12.521F;
		double D1 = -5.264d,D2 = 12.521D;
		System.out.println("float长度:"+F1+" ~ "+F2);
		System.out.println("double长度:"+D1+" ~ "+D2);
		System.out.println("------------字符相关----------------");
		System.out.println("转义字符:"+"\u2605");
		System.out.println("单引号:"+"\'");
		System.out.println("反斜杠:"+"\\");
		System.out.println("垂直制表符:"+"\t");
		System.out.println("回车:"+"\r");
		System.out.println("换行:"+"\n");
		System.out.println("退格:"+"\b");
		System.out.println("换页:"+"\f");
		System.out.println("------------布尔型----------------");
		boolean b1 = true,b2 = false;
		System.out.println("布尔类型:"+b1+','+b2);
		System.out.println("-----------常量-----------------");
		final int Const = 21025;
		System.out.println(Const);
	}
	
}

你可能感兴趣的:((4)java的数据类型)