Skip to content

Commit 3956448

Browse files
author
hollis.zhl
committed
增加知识点整理
1 parent 131a589 commit 3956448

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Java的继承与实现
6363

6464
[什么是单精度和双精度?](/basics/java-basic/single-double-float.md)
6565

66-
[为什么不能用浮点型表示金额?](float-amount.md)
66+
[为什么不能用浮点型表示金额?](/basics/java-basic/float-amount.md)
6767

6868
#### 自动拆装箱
6969

@@ -79,7 +79,7 @@ Java的继承与实现
7979

8080
replaceFirst、replaceAll、replace区别、
8181

82-
String对“+”的重载
82+
[String对“+”的重载](/basics/java-basic/string-append.md)
8383

8484
[字符串拼接的几种方式和区别](/basics/java-basic/string-concat.md)
8585

basics/java-basic/string-append.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1. String s = "a" + "b",编译器会进行常量折叠(因为两个都是编译期常量,编译期可知),即变成 String s = "ab"
2+
3+
2. 对于能够进行优化的(String s = "a" + 变量 等)用 StringBuilder 的 append() 方法替代,最后调用 toString() 方法 (底层就是一个 new String())

0 commit comments

Comments
 (0)