摘要: public class Day08 { public static void main(String[] args) { //x ? y : z //如果x==true ,则结果为y 否则为z int score = 80; String type = score<60?"不及格" : "及格"; 阅读全文
posted @ 2021-08-07 11:17 幻协 阅读(31) 评论(0) 推荐(0)
摘要: public class Day07 { public static void main(String[] args) { int a = 10; int b = 20; a+=b;//a=a+b a-=b;//a=a-b System.out.println(a); //字符串连接 System. 阅读全文
posted @ 2021-08-07 11:17 幻协 阅读(36) 评论(0) 推荐(0)
摘要: public class Day06 { public static void main(String[] args) { //位运算一般是用于操作二进制 /* A = 0011 1100 B = 0000 1101 A&B = 0000 1100 //当上下两位都位1时才为1不然就是0 A|B = 阅读全文
posted @ 2021-08-07 11:16 幻协 阅读(42) 评论(0) 推荐(0)
摘要: public class Day05 { public static void main(String[] args) { //与(and) 或(or) 非(取反) boolean a = true; boolean b = false; System.out.println("a && b"+(a 阅读全文
posted @ 2021-08-07 11:16 幻协 阅读(34) 评论(0) 推荐(0)
摘要: <div><br class="Apple-interchange-newline">public class Day04 { public static void main(String[] args) { //++ -- 自增,自减 一元运算符 int a = 3;</div> public c 阅读全文
posted @ 2021-08-07 11:16 幻协 阅读(497) 评论(0) 推荐(0)
摘要: 算数运算符:+,-,*,/,%(取余),++,--赋值运算符:=关系运算符:>,<,>=,<=,==,!=逻辑运算符:&&(与:我和你(必须)),||(或:我和你或她(不是必须)),!(非(必须有一边满足,非黑即白))位运算符:&,|,^,~,>>,<<条件运算符:?,:扩展赋值运算符:+=,-=, 阅读全文
posted @ 2021-08-07 11:15 幻协 阅读(37) 评论(0) 推荐(0)
摘要: 变量是什么:变量是可以变化的量 java是一种强类型语言,每个变量都必须声明其类型 java变量是程序中最基本的存储单元,其要素包括变量名,变量类型和”作用域“ type varName [=value] [{,varName[=value]}];//数据类型 变量名 = 值; 可以使用逗号隔开一次 阅读全文
posted @ 2021-08-07 11:15 幻协 阅读(55) 评论(0) 推荐(0)
摘要: 大转小时如果超过了所转数据的最大值时会出现内存溢出的现象 int i = 128; byte b =(byte) i;​ //强制转换 (转换类型)变量名 可能会丢失精度 //自动转换 低 到 高 一般不会丢失精度 System.out.println(i); System.out.println( 阅读全文
posted @ 2021-08-07 11:14 幻协 阅读(35) 评论(0) 推荐(0)