diff --git a/notes/Java IO.md b/notes/Java IO.md index ee23a4bb..acb95b36 100644 --- a/notes/Java IO.md +++ b/notes/Java IO.md @@ -182,8 +182,10 @@ public static void readFileContent(String filePath) throws IOException { ```java public static void main(String[] args) throws IOException, ClassNotFoundException { + A a1 = new A(123, "abc"); String objectFile = "file/a1"; + ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(objectFile)); objectOutputStream.writeObject(a1); objectOutputStream.close(); @@ -195,6 +197,7 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio } private static class A implements Serializable { + private int x; private String y; diff --git a/notes/Java 基础.md b/notes/Java 基础.md index 5b689cf8..d8f17cef 100644 --- a/notes/Java 基础.md +++ b/notes/Java 基础.md @@ -685,26 +685,26 @@ protected void finalize() throws Throwable {} **1. 等价关系** -(一)自反性 +Ⅰ 自反性 ```java x.equals(x); // true ``` -(二)对称性 +Ⅱ 对称性 ```java x.equals(y) == y.equals(x); // true ``` -(三)传递性 +Ⅲ 传递性 ```java if (x.equals(y) && y.equals(z)) x.equals(z); // true; ``` -(四)一致性 +Ⅳ 一致性 多次调用 equals() 方法结果不变 @@ -712,7 +712,7 @@ if (x.equals(y) && y.equals(z)) x.equals(y) == x.equals(y); // true ``` -(五)与 null 的比较 +Ⅴ 与 null 的比较 对任何不是 null 的对象 x 调用 x.equals(null) 结果都为 false @@ -741,6 +741,7 @@ System.out.println(x == y); // false ```java public class EqualExample { + private int x; private int y; private int z; diff --git a/notes/Java 虚拟机.md b/notes/Java 虚拟机.md index 333c1418..2ad1527c 100644 --- a/notes/Java 虚拟机.md +++ b/notes/Java 虚拟机.md @@ -30,7 +30,7 @@ # 一、运行时数据区域 -