Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Does Java pass arguments by value or reference?

Answer Posted / mr.h

In Java no matter what type of argument you
pass the corresponding parameter (primitive variable or object reference) will get a copy of that data, which is
exactly how pass-by-value (i.e. copy-by-value) work.

In Java, if a calling method passes a reference of an object as an argument to the called method then the passedin
reference gets copied first and then passed to the called method. Both the original reference that was
passed-in and the copied reference will be pointing to the same object. So no matter which reference you use, you
will be always modifying the same original object, which is how the pass-by-reference works as well

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between static and non-static with examples?

1989


In RMI, inorder to sent the stub reference to the client, is we have to load the server object first into the memory or can we directly sent reference to the client?

2138


Is jvm a overhead?

1160


What do you need to set-up a cluster with jboss?

1119


What is the difference between the string and stringbuffer classes?

1156


What’s jboss jbpm?

1080


How task's priority is used in scheduling?

2337


Name the class that is used to bind the server object with RMI Registry?

2219


What are the purpose of introspection?

1257


How will you pass parameters in RMI? Why do you serialize?

1310


Can constructors be synchronized in java?

1171


What is a modular application? What does module-relative mean?

1116


What method is invoked to cause an object to begin executing as a separate thread?

1092


Can I use javascript to submit a form?

1197


What is scalable, portability in the view of J2EE?

2572