摘要:
public static void main(String[] args) { List<String> allElements = List.of("a","b","c","d","e","f"); List<String> allList = new ArrayList<>(allElemen 阅读全文
posted @ 2022-09-25 15:27
YaosGHC
阅读(31)
评论(0)
推荐(0)
摘要:
已经知道的,字符串直接量会采用字符串常量池 new String会创建一个新的对象并分配内存地址 所以他俩==返回是false 我起初是不知道这个intern()方法是干嘛的 intern()方法返回字符串对象的规范化表示形式 从字符串常量池中查询当前字符串是否存在,若不存在就会将当前字符串放入常量 阅读全文
posted @ 2022-09-25 12:22
YaosGHC
阅读(25)
评论(0)
推荐(0)
摘要:
public static void main(String[] args) { System.out.println(test()); } public static int test(){ int a= 1; try{ a=2/0; return a; }catch (Exception e){ 阅读全文
posted @ 2022-09-25 11:52
YaosGHC
阅读(20)
评论(0)
推荐(0)
摘要:
public static void main(String[] args) { String s=""; System.out.println(s==null); int[] arr = new int[]{}; System.out.println(arr==null); List<Intege 阅读全文
posted @ 2022-09-25 11:35
YaosGHC
阅读(23)
评论(0)
推荐(0)