Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
209 views
in Technique[技术] by (71.8m points)

java - what is the difference between pass by reference and call by reference?

what is the difference between pass by reference and call by reference in java ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Java does not pass any variables by reference.

It is tempting to think of objects being passed by reference in Java -- but harmful. Variables of object type are references. When passed, they are passed by value.

In other languages, pass-by-reference and call-by-reference are the same thing.

Edit: More detail is provided in the existing stackoverflow question "Is Java pass by reference?" (Spoiler: No.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...