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 a non-repeatable read?

2429


Which textcomponent method is used to set a textcomponent to the read-only state?

1137


Difference between new operator and class.forname().newinstance()?

1137


What is the relation between the infobus and rmi?

1008


Why use a datasource when you can directly specify a connection details?

1033


Which are the different segments of memory?

1083


What is colon_pkg_prefixes and what is its use?

2520


what is an isolation level?

2761


Difference between hashmap and hashtable?

1158


What is a modular application?

1084


What is the purpose of the wait() method?

1204


Explain the different types of memory used by jvm?

1146


Describe responsibilities of Activator?

2277


What class is used to create Server side object ?

2252


Explain about local interfaces.

1060