public class KY2_1 {
public static void main(String[] args) {
byte b=0x55;
short s=0x55ff;
int i=1000000;
long l=0xffffL;
char c='a';
float f=0.23F;
double d=0.7E-3;
boolean B=true;
String S="这是字符串类数据类型";
System.out.println("字节型变量 b = "+b);
System.out.println("短整型变量 s = "+s);
System.out.println(" 整型变量 i = "+i);
System.out.println("长整型变量 l = "+l);
System.out.println("字符型变量 c = "+c);
System.out.println("浮点型变量 f = "+f);
System.out.println("双精度变量 d = "+d);
System.out.println("布尔型变量 B = "+B);
System.out.println("字符串类对象 S = "+S);
}
}
各数据类型如下:
点击打开链接