摘要:
++ -- 自增 自减 一元运算符int a=3;int b=a++;//a++ a = a + 1 执行完这行代码后,先给b赋值,再进行自增int c=++a;//先自增,再进行c赋值System.out.println(a);System.out.println(b);System.out.pr 阅读全文
posted @ 2022-02-19 23:04
SmallPepsi
阅读(38)
评论(0)
推荐(0)
摘要:
int a = 10;int b = 20;int c = 33;System.out.println(a>b);System.out.println(a<b);System.out.println(a==b);System.out.println(a>=b);System.out.println( 阅读全文
posted @ 2022-02-19 23:01
SmallPepsi
阅读(13)
评论(0)
推荐(0)
摘要:
顺序从低到高 byte,short,char -> int -> long -> float -> doubledouble e = 500;long a = 1000L;int b = 100;short c = 10;byte d = 8;System.out.println(a+b+c+d+e 阅读全文
posted @ 2022-02-19 22:39
SmallPepsi
阅读(32)
评论(0)
推荐(0)
摘要:
//类变量 staticstatic double salary = 2500;//实例变量:从属于对象(类),如果不自行初始化,这个类型的默认值 0 0.0//布尔值:默认是false//除了基本类型,其余的默认值都是nullString name;int age;//main方法public s 阅读全文
posted @ 2022-02-19 22:17
SmallPepsi
阅读(37)
评论(0)
推荐(0)
摘要:
操作比较大的数的时候,注意溢出问题//JDK7新特性 数字间可以用下滑线分割int money = 10000_0000_0;int years = 20;int total = money*years;long total2 = money*years;//默认是int,转换之前已经存在问题了lo 阅读全文
posted @ 2022-02-19 22:11
SmallPepsi
阅读(24)
评论(0)
推荐(0)
摘要:
// 级别从低到高排序 byte,short,char -> int -> long -> float -> double int i = 128;byte b = (byte)i;//强制转换 (类型)变量名 高--低//自动转换 低--高System.out.println(i);System. 阅读全文
posted @ 2022-02-19 22:08
SmallPepsi
阅读(27)
评论(0)
推荐(0)
摘要:
//二进制0b开头 十进制 八进制0开头 十六进制0x开头int i = 10;int i1 = 010;//八进制int i2= 0x10; //十六进制System.out.println(i+"+"+i2+"+"+i1);//浮点数拓展//float 有限 离散 舍入误差 大约 接近但不等于/ 阅读全文
posted @ 2022-02-19 22:07
SmallPepsi
阅读(29)
评论(0)
推荐(0)
摘要:
八大基本数据类型 八大基本数据类型:byte,short,long,int,float,double,char,boolean //整数 int num1 = 10; byte num2 = 20; //byte不能超过127 short num3 = 30; long num4 = 30L;//l 阅读全文
posted @ 2022-02-19 22:04
SmallPepsi
阅读(32)
评论(0)
推荐(0)

浙公网安备 33010602011771号