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...

Explain the following statement: Java is always pass-by-value.

Answer Posted / qamrun nisa

Other languages use pass-by-reference or pass-by-pointer.
But 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) works.

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 ?    15 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why java is not 100% object oriented language?

979


What is a component in java?

884


Describe the ear, war, and jar.

917


Give some advantages of orm (object-relational mapping)?

1027


What is a gui in java?

855


What does the web module contain?

952


What is event handling in java?

868


What do you mean by the deployment descriptor?

976


What are struts?

888


What is application component provider?

994


What is api in j2ee?

844


What is B2B?

972


What is distributed application?

938


Is java is fully object oriented?

941


What is javaserver pages standard tag library (jstl)?

840