We have two simple method one method in java one method in c# ,both of this two method get one parameter and return parameter+1 after it,I change this sample for test a object input not primitive value.

.c#

Java :

and java script:

also,you see our parameter not change after call function sum.

we change param type from integer to a class with a one property as integer .

C# :

Java :

Javascript:

now we change the code and create new instance in sum method of input object:

C#:

Java :

now I change Call by value to reference :

C#:

Java :

so we have Error here , You simply can’t do that in Java.)

since Java doesn’t support pointers …

but in javascript :

Javascript is always pass by value, but when a variable refers to an object (including arrays), the “value” is a reference to the object.

Changing the value of a variable never changes the underlying primitive or object, it just points the variable to a new primitive or object.

However, changing a property of an object referenced by a variable does change the underlying object.