03 2022 档案
摘要:图中add为切入点 1.add无异常时 2.add有异常时
阅读全文
摘要:建议观看视频:https://www.bilibili.com/video/BV1iq4y1u7vj?p=119&t=696.7 如果要完整复习B+Tree 可以从该视频的前几个视频开始看 为什么选B+Tree,而不选Hash? 但是!MySQL可以选择 “自适应Hash索引” 即,将频繁找的一个值
阅读全文
摘要:使用游标,会对数据进行加锁。在并发量大的时候,会影响效率;还会消耗系统资源,造成内存不足,这是因为游标是在内存中进行处理的 建议:用完之后一定要CLOSE
阅读全文
摘要:设有byte[]数组: byte[] buf 1 ByteArrayInputStream bais = new ByteArrayInputStream(buf); 2 DataInputStream dis = new DataInputStream(bais); 3 System.out.pr
阅读全文
摘要:1. 选择排序 (就是选择出1个数来,把它和后面的每个数都比较) 1 for (int i = 0; i < a.length; i ++) { 2 for (int j = i + 1; j < a.length; j ++) { 3 if (a[i] > a[j]) { 4 int tmp =
阅读全文
摘要:A. String的内容是不可变的,而后两者是内容可变的 B. StringBuffer是同步的,安全性更高; StringBuilder是异步的,非线程安全,性能更高。 另: StringBuffer和数组的区别? 答:StringBuffer存放的是字符串 数组可以存放任意类型数据,但必须是同一
阅读全文
摘要:两句 分开写 String s = new String("abc"); String s = "abc"; 前者创建2个对象 后者创建1个对象 如果是在同一个程序,只有这两句话 String s1 = new String("abc"); String s2 = "abc"; 前者创建了2个对象,
阅读全文
摘要:在标识处编写程序输出 HelloWorld 1 public class test { 2 public static void main(String[] args) { 3 Outer.method().show(); 4 } 5 } 6 7 interface Inter { 8 void s
阅读全文
摘要:1 interface class Inter { 2 public abstract void show(); 3 public abstract void show2(); 4 } 5 6 class Demo { 7 public void method() { 8 Inter i = new
阅读全文
摘要:class Outer { public int num = 10; public void fun() { final int num = 10; class Inner { public void show() { System.out.println(num); } } Inner in =
阅读全文
摘要:以下程序会输出 30,20,10 class Outer { public int num = 10; class Inner { public int num = 20; public void show() { int num = 30; System.out.println(num); Sys
阅读全文
摘要:static可以修饰内部类 (因为内部类可以看作是类成员) 不能修饰外部类 正常内部类: Outer.Inner 对象名 = new Outer().new Inner(); 如果是static内部类: Outer,Inner 对象名 = new Outer.Inner();
阅读全文
摘要:编写的前后顺序:package > import > class 且一个文件最多只能有 1个package
阅读全文
摘要:在main方法里直接写: new StudentDemo().method(new Student());
阅读全文
摘要:成员变量:默认修饰符 public static final 无构造方法 成员方法:默认修饰符 public abstract 另: 类与类:只可 单继承 接口与类:可以 多实现 接口与接口: 可以 多继承
阅读全文
摘要:final修饰局部变量 局部变量为基本数据类型:不可改变其值 局部变量为引用类型(如类):可以修改其内部成员值,不可修改该变量的地址值
阅读全文
摘要:class Father { static { System.out.println("静态代码块Father"); } { System.out.println("构造代码块Father"); } public Father() { System.out.println("构造方法Father")
阅读全文
摘要:执行顺序:静态代码块 -- 构造代码块 -- 构造方法 (与编写代码的顺序无关) class Code { // 静态代码块 static { int x = 1; System.out.println(x); } // 构造代码块 { int x = 2; System.out.println(x
阅读全文
摘要:private 构造方法名(){}; 然后再把类中的各个方法定义成static,在外界直接通过类名调用方法,无需创建对象
阅读全文

浙公网安备 33010602011771号