auto commit

This commit is contained in:
CyC2018 2018-09-05 17:22:45 +08:00
parent 5fe72c31d8
commit a015b11038
4 changed files with 13 additions and 8 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 虚拟机栈中入栈和出栈的过程。
<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 虚拟机栈内存大小:

View File

@ -1433,7 +1433,8 @@ public boolean IsPopOrder(int[] pushSequence, int[] popSequence) {
Stack<Integer> stack = new Stack<>();
for (int pushIndex = 0, popIndex = 0; pushIndex < n; pushIndex++) {
stack.push(pushSequence[pushIndex]);
while (popIndex < n && stack.peek() == popSequence[popIndex]) {
while (popIndex < n && !stack.isEmpty()
&& stack.peek() == popSequence[popIndex]) {
stack.pop();
popIndex++;
}