long d =10000 L
float e = 1.2 f
long d =10000 L
float e = 1.2 f
数字后加l表示long类型
long常量后面加上 L 或者 l
float变量后面加上f 或者 F
long 和 float不能自动转换
boolean 判断对错】
boolean类型 true false
大整数后面跟L
数值类型分为 整数,浮点(小数点),字符
boolean类型true和false
整数 默认为 int,小数 默认为 double 类型
在使用 long 类型时,例如long=100000L;末尾要加一个"L"(不区分大小写)
在使用 float类型时,例如 float = 1.5f ;末尾要加一个“f”(不区分大小写)
public class DetaType{
public static void main(String[] args){
byte a = 100;
short b = 20000;
int c = 100000000;
long d =1000000000000l;
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
float e = 1.2f;
double f =4.5;
System.out.println(e);
System.out.println(f);
char cA = 'a';
char cB = ' ';
char cC = '(';
System.out.println(cA);
System.out.println(cB);
System.out.println(cC);
boolean h = true;
boolean i = false;
System.out.println(h);
System.out.println(i);
}
}
public static void main(String[] args)
System.out.println();
boolean h = true;
没有
pi
变量类型等于数据类型
熟悉各种字符类型使用
赋值时超过long型可以在long后边的赋值语句加上大写的L
基本数据类型
数字型
byte
short
int
long
float
double
字符型
string
char