Does Java pass arguments by value or reference?

Answer Posted / prs01

Pass by value.
1. When passing primitives, it passes a copy of the
variable to the method. Any change made in the method does
not reflect in the calling method.
2. When dealing with objects, a copy of their
reference/address is passed. Thus the change made to the
object is reflected in the calling method.

Is This Answer Correct ?    22 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is abstract schema?

771


How to pass parameters in RMI?

1974


What is threadfactory?

859


If I wanted to use a solarisui for just a jtabbedpane, and the metal ui for everything else, how would I do that?

782


What is TL and its use?

2215


Is the session factory thread safe?

917


What is the difference between RMI registry and OS Agent?

880


Explain about thread synchronization inside a monitor?

2240


Difference between swing and awt?

842


Which characters may be used as the second character of an identifier, but not as the first character of an identifier?

783


Why is string immutable in java?

820


What is local interface. How values will be passed?

771


What are the steps to write p-to-p model application?

2175


What is the difference between session and entity beans?

810


What are the benefits of detached objects?

809