摘要: 扩展赋值运算符 package operator; public class demo05 { public static void main(String[] args) { int a = 10; int b =20; a +=b; // a = a + b a -=b; // a = a - 阅读全文
posted @ 2023-02-03 16:50 chengh0618 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 左移和右移详细说明 1、<<(左移) 1.运算规则: 按二进制形式把所有的数字向左移动对应的位数,高位移出(舍弃),低位的 空位补零。 2.语法格式: 需要移位的数字 << 移位的次数 例如: 3 << 2,则是将数字3左移2位 计算过程: 3 << 2 首先把3转换为二进制数字0000 0011, 阅读全文
posted @ 2023-02-03 15:45 chengh0618 阅读(838) 评论(0) 推荐(0) 编辑
摘要: 位运算符 package operator; public class demo04 { public static void main(String[] args) { /* 位运算符与,或,非 & | ~ A = 0011 1100 B = 0000 1101 A & B = 0000 1100 阅读全文
posted @ 2023-02-03 15:44 chengh0618 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 逻辑运算符 逻辑运算符 && , || , ! package operator; public class demo03 { public static void main(String[] args) { //逻辑运算符,与(and)、或(or)、非(取反) boolean a = true; 阅读全文
posted @ 2023-02-03 15:42 chengh0618 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 自增、自减运算、Math类 package operator; public class demo2 { public static void main(String[] args) { //++ -- 自增,自减,一元运算符 int a = 3; int b = a++;//执行完这行代码,先给b 阅读全文
posted @ 2023-02-02 18:46 chengh0618 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 基本运算符 1、算术运算符:+ ,-, *, /, %, ++, -- 2、赋值运算符 = 3、关系运算符 > , < , >= , <= , == , != , instanceof 4、逻辑运算符 && , || , ! 以上需熟练 5、位运算符 & , ^ , ~ , >> , << , >> 阅读全文
posted @ 2023-02-02 17:00 chengh0618 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 变量 //数据类型 变量名=值;可以使用逗号隔开来声明多个同类型变量但不建议 type varName = value ; 例: int age = 10 ; String name = "sara" ; double pi = 3.14 ; char x = 'X' ; 注意事项 1、每个变量都有 阅读全文
posted @ 2023-02-01 16:40 chengh0618 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 数据类型 基本数据类型 整数4个 int num1 = 10;//最常用 byte num2 =20; short num3 = 30; long num4 =30L;//long类型要加L 小数2个:浮点数 float num5 = 50.1F;//float类型要加F double num6 = 阅读全文
posted @ 2023-01-30 18:39 chengh0618 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 标识符 关键字 | abstract | assert | boolean | break | byte | case | | | | | | | | | catch | char | class | const | continue | default | | do | double | else 阅读全文
posted @ 2023-01-30 18:37 chengh0618 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 注释 单行注释 //注释描述内容 多行注释 /* *注释描述内容 */ 文档注释 /** * @deprecated * @author */ 设置注释格式 设置类自动加载注释 File->Settings-Editor-File and Code Templates,选择Files选项卡下面Cla 阅读全文
posted @ 2022-01-27 18:05 chengh0618 阅读(115) 评论(0) 推荐(0) 编辑