Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ad57ac4

Browse files
Merge pull request #2718 from suozq1/patch-1
Update why-there-only-value-passing-in-java.md
2 parents 1b78360 + 3924653 commit ad57ac4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎docs/java/basis/why-there-only-value-passing-in-java.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void sayHello(String str) {
3232
程序设计语言将实参传递给方法(或函数)的方式分为两种:
3333

3434
- **值传递**:方法接收的是实参值的拷贝,会创建副本。
35-
- **引用传递**:方法接收的直接是实参所引用的对象在堆中的地址,不会创建副本,对形参的修改将影响到实参
35+
- **引用传递**:方法接收的直接是实参的地址,而不是实参内的值,这就是指针,此时形参就是实参,对形参的任何修改都会反应到实参,包括重新赋值
3636

3737
很多程序设计语言(比如 C++、 Pascal)提供了两种参数传递的方式,不过,在 Java 中只有值传递。
3838

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /