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 RMI and Socket?

1009


What is in-memory replication?

1009


What is the highest-level event class of the event-delegation model?

1032


What is a clone?

1002


What is the difference between long.class and long.type?

1002


Can you give me a simple example of using the requiredif validator rule?

1065


What modifiers may be used with an inner class that is a member of an outer class?

1002


How to deploy Jar, War files in J2EE?

2620


Name the eight primitive java types.

1058


What restrictions are placed on the location of a package statement within a source code file?

1057


What is mdb and what is the special feature of that?

1011


What are the types of scaling?

1044


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

994


What is the relation between the infobus and rmi?

950


Write a singleton program?

988