1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-25 02:27:10 +08:00

!24 update docs/java/basis/java-basic-questions-02.md.

Merge pull request !24 from 格致诚正,修齐治平/N/A
This commit is contained in:
SnailClimb 2023-07-24 10:18:30 +00:00 committed by Gitee
commit 9e566a516a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -761,7 +761,7 @@ String d = str1 + str2; // 常量池中的对象
System.out.println(c == d);// true System.out.println(c == d);// true
``` ```
`final` 关键字修之后的 `String` 会被编译器当做常量来处理,编译器在程序编译期就可以确定它的值,其效果就相当于访问常量。 `final` 关键字修之后的 `String` 会被编译器当做常量来处理,编译器在程序编译期就可以确定它的值,其效果就相当于访问常量。
如果 ,编译器在运行时才能知道其确切值的话,就无法对其优化。 如果 ,编译器在运行时才能知道其确切值的话,就无法对其优化。