随笔分类 -  java

摘要:首先给出要验证的结论: 一、当有static修饰的静态代码时 父类静态代码块(同类内static修饰的属性按顺序执行)>子类静态代码块(同类内static修饰的成员按顺序执行)>父类属性、代码块(按声明顺序执行) >父类构造器> 子类属性、代码块(按声明顺序执行)>子类构造器 二、当没有static 阅读全文
posted @ 2021-01-11 15:28 我怎么这么好看 阅读(114) 评论(0) 推荐(0)
摘要:举一个例子其他雷同: int Integer String 一、int,String 转Integer(定义时) Integer a=new Integer(int value); Integer a=new Integer(String value); 二、String 转Integer Inte 阅读全文
posted @ 2020-12-31 22:18 我怎么这么好看 阅读(82) 评论(0) 推荐(0)
摘要:1. forEach and Map普通方式遍历 Map Map<String, Integer> items = new HashMap<>(); items.put("A", 10); items.put("B", 20); items.put("C", 30); items.put("D", 阅读全文
posted @ 2020-12-31 22:03 我怎么这么好看 阅读(88) 评论(0) 推荐(0)
摘要:一、基于基本数据类型的变量创建的数组: byte short int long double float char boolean 对于基本数据类型为: byte short int long 初始化为 0 对于基本数据类型为: double float 默认的为 0.0 boolean 对于基本数 阅读全文
posted @ 2020-12-31 22:00 我怎么这么好看 阅读(311) 评论(0) 推荐(0)
摘要:1、String abc=null,声明了一个字符串对象的空引用,在栈内创建了栈帧或句柄,未在堆内存内分配空间; 2、String abc="",声明了一个空字符串对象,初始化栈内分配了内存,指向常量池空字符串地址; 3、String abc,声明了字符串对象,但为分配内存。作为成员变量时程序运行会 阅读全文
posted @ 2020-12-29 10:17 我怎么这么好看 阅读(144) 评论(0) 推荐(0)