•In Java, parameters can be passed in two ways. They are:
1) Pass-by-value
2) Pass-by-reference
•In Pass-by-value the modifications on the formal parameters are not reflected on the actual parameters.
•In Pass-by-reference the modifications on the formal parameters are reflected on the actual parameters.
•In Java, all the primitive types are passed by value.
•In Java, objects are passed by reference.
Pass-By-Value Example:
Pass-By-Reference Example:
1) Pass-by-value
2) Pass-by-reference
•In Pass-by-value the modifications on the formal parameters are not reflected on the actual parameters.
•In Pass-by-reference the modifications on the formal parameters are reflected on the actual parameters.
•In Java, all the primitive types are passed by value.
•In Java, objects are passed by reference.
Pass-By-Value Example:
Pass-By-Reference Example:
what you posted is actually good but for someone who is researching about parameter passing for the first time, like me , you need to explain your code further .
ReplyDeletewhat you posted is actually good but for someone who is researching about parameter passing for the first time, like me , you need to explain your code further
ReplyDelete