Interview Question in Java


 

Interview Question :: Why java is said to be pass-by-value ?

 Why java is said to be pass-by-value ?

by ksk
VoteNowAnswers to "Why java is said to be pass-by-value ?"

When assigning an object to a variable, we are actually assigning the memory address of that object to the variable. So the value passed is actually the memory location of the object. This results in object aliasing, meaning you can have many variables referring to the same object on the heap. 

by ksk