in java ,programmer can declare a method with varargs parameter ,It means the method cannot parameter call 0 or more parameter . for example string.format . it possible with varargs feature.
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.
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 .
now we change the code and create new instance in sum method of input object:
now I change Call by value to reference :
so we have Error here , You simply can’t do that in Java.)
since Java doesn’t support pointers …
- 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.