auto commit
This commit is contained in:
parent
5fe72c31d8
commit
a015b11038
|
@ -182,8 +182,10 @@ public static void readFileContent(String filePath) throws IOException {
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public static void main(String[] args) throws IOException, ClassNotFoundException {
|
public static void main(String[] args) throws IOException, ClassNotFoundException {
|
||||||
|
|
||||||
A a1 = new A(123, "abc");
|
A a1 = new A(123, "abc");
|
||||||
String objectFile = "file/a1";
|
String objectFile = "file/a1";
|
||||||
|
|
||||||
ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(objectFile));
|
ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(objectFile));
|
||||||
objectOutputStream.writeObject(a1);
|
objectOutputStream.writeObject(a1);
|
||||||
objectOutputStream.close();
|
objectOutputStream.close();
|
||||||
|
@ -195,6 +197,7 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class A implements Serializable {
|
private static class A implements Serializable {
|
||||||
|
|
||||||
private int x;
|
private int x;
|
||||||
private String y;
|
private String y;
|
||||||
|
|
||||||
|
|
|
@ -685,26 +685,26 @@ protected void finalize() throws Throwable {}
|
||||||
|
|
||||||
**1. 等价关系**
|
**1. 等价关系**
|
||||||
|
|
||||||
(一)自反性
|
Ⅰ 自反性
|
||||||
|
|
||||||
```java
|
```java
|
||||||
x.equals(x); // true
|
x.equals(x); // true
|
||||||
```
|
```
|
||||||
|
|
||||||
(二)对称性
|
Ⅱ 对称性
|
||||||
|
|
||||||
```java
|
```java
|
||||||
x.equals(y) == y.equals(x); // true
|
x.equals(y) == y.equals(x); // true
|
||||||
```
|
```
|
||||||
|
|
||||||
(三)传递性
|
Ⅲ 传递性
|
||||||
|
|
||||||
```java
|
```java
|
||||||
if (x.equals(y) && y.equals(z))
|
if (x.equals(y) && y.equals(z))
|
||||||
x.equals(z); // true;
|
x.equals(z); // true;
|
||||||
```
|
```
|
||||||
|
|
||||||
(四)一致性
|
Ⅳ 一致性
|
||||||
|
|
||||||
多次调用 equals() 方法结果不变
|
多次调用 equals() 方法结果不变
|
||||||
|
|
||||||
|
@ -712,7 +712,7 @@ if (x.equals(y) && y.equals(z))
|
||||||
x.equals(y) == x.equals(y); // true
|
x.equals(y) == x.equals(y); // true
|
||||||
```
|
```
|
||||||
|
|
||||||
(五)与 null 的比较
|
Ⅴ 与 null 的比较
|
||||||
|
|
||||||
对任何不是 null 的对象 x 调用 x.equals(null) 结果都为 false
|
对任何不是 null 的对象 x 调用 x.equals(null) 结果都为 false
|
||||||
|
|
||||||
|
@ -741,6 +741,7 @@ System.out.println(x == y); // false
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class EqualExample {
|
public class EqualExample {
|
||||||
|
|
||||||
private int x;
|
private int x;
|
||||||
private int y;
|
private int y;
|
||||||
private int z;
|
private int z;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
# 一、运行时数据区域
|
# 一、运行时数据区域
|
||||||
|
|
||||||
<div align="center"> <img src="../pics//c9ad2bf4-5580-4018-bce4-1b9a71804d9c.png" width="400"/> </div><br>
|
<div align="center"> <img src="../pics//c9ad2bf4-5580-4018-bce4-1b9a71804d9c.png" width="450"/> </div><br>
|
||||||
|
|
||||||
## 程序计数器
|
## 程序计数器
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
每个 Java 方法在执行的同时会创建一个栈帧用于存储局部变量表、操作数栈、常量池引用等信息。从方法调用直至执行完成的过程,就对应着一个栈帧在 Java 虚拟机栈中入栈和出栈的过程。
|
每个 Java 方法在执行的同时会创建一个栈帧用于存储局部变量表、操作数栈、常量池引用等信息。从方法调用直至执行完成的过程,就对应着一个栈帧在 Java 虚拟机栈中入栈和出栈的过程。
|
||||||
|
|
||||||
<div align="center"> <img src="../pics//926c7438-c5e1-4b94-840a-dcb24ff1dafe.png" width="450"/> </div><br>
|
<div align="center"> <img src="../pics//926c7438-c5e1-4b94-840a-dcb24ff1dafe.png" width="500"/> </div><br>
|
||||||
|
|
||||||
可以通过 -Xss 这个虚拟机参数来指定每个线程的 Java 虚拟机栈内存大小:
|
可以通过 -Xss 这个虚拟机参数来指定每个线程的 Java 虚拟机栈内存大小:
|
||||||
|
|
||||||
|
|
|
@ -1433,7 +1433,8 @@ public boolean IsPopOrder(int[] pushSequence, int[] popSequence) {
|
||||||
Stack<Integer> stack = new Stack<>();
|
Stack<Integer> stack = new Stack<>();
|
||||||
for (int pushIndex = 0, popIndex = 0; pushIndex < n; pushIndex++) {
|
for (int pushIndex = 0, popIndex = 0; pushIndex < n; pushIndex++) {
|
||||||
stack.push(pushSequence[pushIndex]);
|
stack.push(pushSequence[pushIndex]);
|
||||||
while (popIndex < n && stack.peek() == popSequence[popIndex]) {
|
while (popIndex < n && !stack.isEmpty()
|
||||||
|
&& stack.peek() == popSequence[popIndex]) {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
popIndex++;
|
popIndex++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user