摘要:
包机制 为了更好地组织类,java提供了包机制,用于区别类名的命名空间 包语句的语法格式为: package pkg1[. pkg2[. pkg3...]]; 一般利用公司域名倒置作为包名; 为了能够使用某一个包的成员,我们需要在java程序中导入该包,程序中明确导入该包,使用“import”语句可
阅读全文
posted @ 2022-04-13 14:28
努力努努力
阅读(22)
推荐(0)
摘要:
package operator;//三元运算符public class Demo08 { public static void main(String[] args) { // x ? y : z // 如果x==true,则结果为y,否则为z int score = 80; String typ
阅读全文
posted @ 2022-04-11 14:59
努力努努力
阅读(17)
推荐(0)
摘要:
package operator;public class Demo07 { 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
阅读全文
posted @ 2022-04-11 14:58
努力努努力
阅读(26)
推荐(0)
摘要:
package operator;public class Demo06 { public static void main(String[] args) { /* A = 0011 1100 B = 0000 1101 A&B = 0000 1100 A|B = 0011 1101 A^B = 0
阅读全文
posted @ 2022-04-10 15:11
努力努努力
阅读(29)
推荐(0)
摘要:
package operator;//逻辑运算符public class Demo05 { // 或(and) 或(or) 非(取反) public static void main(String[] args) { boolean a = true; boolean b =false; Syste
阅读全文
posted @ 2022-04-10 15:10
努力努努力
阅读(19)
推荐(0)
摘要:
运算符 算数运算符:+,-,*,/,++,-- 赋值运算符:= 关系运算符:>,<,>=,<=,==,!=,instanceof 逻辑运算符:&&,||,! 位运算符:&,|,^,~,>>,<<,>>>(了解) 条件运算符:? 扩展赋值运算符:+=,-=,*=,/=
阅读全文
posted @ 2022-04-09 16:16
努力努努力
阅读(19)
推荐(0)
摘要:
package operator;public class Demo04 { public static void main(String[] args) { //++ -- 自增,自减 一元运算符 int a =3; System.out.println(a); int b =a++;//执行完这
阅读全文
posted @ 2022-04-09 16:08
努力努努力
阅读(23)
推荐(0)
摘要:
package operator;public class Demo03 { public static void main(String[] args) { //关系运算符返回的结果: 正确 错误 布尔值表示 int a =10; int b =20; int c =21; //取余,模运算 Sy
阅读全文
posted @ 2022-04-09 16:07
努力努努力
阅读(21)
推荐(0)
摘要:
package operator;public class Demo02 { public static void main(String[] args) { long a =123123123123123l; int b =123; short c =10; byte d =8; System.o
阅读全文
posted @ 2022-04-09 16:07
努力努努力
阅读(18)
推荐(0)
摘要:
package operator;public class Demo01 { public static void main(String[] args) { // 二元运算符 int a =10; int b =20; int c =25; int d =25; System.out.printl
阅读全文
posted @ 2022-04-09 16:06
努力努努力
阅读(22)
推荐(0)