Methods in Java cannot stand on their own; they must be called using classes or objects. If a method is declared with parameters that need to be passed, it must be called with parameters that specify parameter values. The values actually passed to the parameter when the method is called are called arguments.

There is only one way to pass parameters in Java, and that is by value.

For primitive data types, when a method is called to pass parameters, it copies the arguments on the stack of the method. Value passing is when a copy of the actual parameter value is passed into the method without the parameter itself being affected.

For reference types, the object itself is not stored in our main stack, the object itself is stored in the heap, and the variable stored in the stack is the address of the object in the heap, which is a pointer. So when you pass a parameter of a reference type, you actually make a copy of the object’s address to the calling method and store it in the stack of the method, so that the main method and the calling method operate on the same object.