摘要: package operator;//逻辑运算符public class Demo05 { public static void main(String[] args) { // 与(and) 或(or) 非(取反) boolean a = true; boolean b = false; Syst 阅读全文
posted @ 2021-06-07 12:14 Leoyuan 阅读(38) 评论(0) 推荐(0) 编辑
摘要: package operator;public class Demo04 { public static void main(String[] args) { //++ -- 自增,自减 一元运算符 int a = 3; int b = a++; //执行完这行代码后,先给b赋值,再自增 //a = 阅读全文
posted @ 2021-06-07 12:10 Leoyuan 阅读(48) 评论(0) 推荐(0) 编辑
摘要: package operator;public class Demo01 { public static void main(String[] args) { //二元运算符 //Ctrl + D :复制当前行到下一行 int a = 10; int b = 20; int c = 25; int 阅读全文
posted @ 2021-06-07 11:18 Leoyuan 阅读(26) 评论(0) 推荐(0) 编辑
摘要: //变量public class Demo05 { public static void main(String[] args) { //int a, b, c; //int a=1,b=2,b=3; //程序的可读性 String name = "Leo"; char x = 'X'; doubl 阅读全文
posted @ 2021-06-06 23:55 Leoyuan 阅读(36) 评论(0) 推荐(0) 编辑
摘要: //类型转换 public class Demo04 { public static void main(String[] args) { int i = 128; byte b = (byte) i;//内存溢出 //强制转换 (类型)变量名 高--低 //自动转换 低———高 System.ou 阅读全文
posted @ 2021-06-06 23:20 Leoyuan 阅读(35) 评论(0) 推荐(0) 编辑
摘要: public class Demo03 { public static void main(String[] args) { //整数拓展: 进制 二级制0b 十进制 八进制0 十六进制0x int i= 10; int i2 = 010;//八进制0 int i3 = 0x10;//十六进制0x 阅读全文
posted @ 2021-06-06 16:27 Leoyuan 阅读(32) 评论(0) 推荐(0) 编辑
摘要: //数据类型 public class Demo02 { public static void main(String[] args) { //八大基本数据类型 //整数 int num1 = 100;//最常用 byte num2 = 20; short num3 = 30; long num4 阅读全文
posted @ 2021-06-06 15:24 Leoyuan 阅读(39) 评论(0) 推荐(0) 编辑
摘要: //标识符 public class Dome01 { public static void main(String[] args) { //所有的标识符都应该以字母(A-Z或者a-z),美元字符($),或者下划线(_)开始 String Ahello = "leo"; String hello = 阅读全文
posted @ 2021-06-06 15:04 Leoyuan 阅读(33) 评论(0) 推荐(0) 编辑
摘要: //注释//注释并不会被执行//书写注释是一个非常好的习惯,平时写代码一定要注意规范/** java中的注释有三种* 多行注释* 多行注释* 文档注释*/public class HelloWorld { public static void main(String[] args) { //单行注释 阅读全文
posted @ 2021-06-06 14:36 Leoyuan 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 11.1 面向对象的三大特征 1. 封装 封装是面向对象程序设计的核心思想。它是指将对象的属性和行为封装起来,其载体就是类,类通常对客户隐藏其实现细节,这就是封装的思想。 2. 继承 继承是面向对象程序设计提高重用性的重要措施。它体现了特殊类与一般类之间的关系,当特殊类包含了一般类的所有属性和行为, 阅读全文
posted @ 2020-12-02 23:34 Leoyuan 阅读(95) 评论(0) 推荐(0) 编辑