Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (10.2k points)
I'd like semantics similar to C#'s ref keyword.

1 Answer

0 votes
by (46k points)

No.

Why ? Java has only one mode of passing arguments to methods: by value.

Note:

For primitives this is easy to understand: you get a copy of the value.

For all other you get a copy of the reference and this is called also passing by value.

It is all in this picture:

enter image description here

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...