mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-25 08:21:31 +08:00
Compare commits
1 Commits
517e1dbbf4
...
893394a6af
Author | SHA1 | Date | |
---|---|---|---|
893394a6af |
10
docs/java.md
10
docs/java.md
@ -242,12 +242,10 @@ sb.append("!");
|
|||||||
### 比较
|
### 比较
|
||||||
|
|
||||||
```java
|
```java
|
||||||
String s1 = "QuickRef";
|
String s1 = new String("QuickRef");
|
||||||
String s2 = new String("QuickRef");
|
String s2 = new String("QuickRef");
|
||||||
s1 == s2 // false
|
s1 == s2 // false
|
||||||
s1.equals(s2) // true
|
s1.equals(s2) // true
|
||||||
// intern 方法获得字符串常量池中的惟一引用
|
|
||||||
s1 == s2.intern() // true
|
|
||||||
"AB".equalsIgnoreCase("ab") // true
|
"AB".equalsIgnoreCase("ab") // true
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -312,7 +310,7 @@ int[] a3 = new int[]{1, 2, 3};
|
|||||||
int[] a4 = new int[3];
|
int[] a4 = new int[3];
|
||||||
a4[0] = 1;
|
a4[0] = 1;
|
||||||
a4[2] = 2;
|
a4[2] = 2;
|
||||||
a4[3] = 3; // 会出现索引越界异常
|
a4[3] = 3;
|
||||||
```
|
```
|
||||||
|
|
||||||
### 修改 Modify
|
### 修改 Modify
|
||||||
|
Reference in New Issue
Block a user