Call by Value and Call by Reference
Java only supports the call by value but not the call by reference. The call by value means that you are calling a method by passing it a value. The value will only get changed in the called method and is remain unaffected in the calling method.
Call by value: Example-
Output-
Call by value by passing the class reference-
Output-