Call by Value and Call by Reference in Java
Java is call by value. For int, the method gets a copy. Changing the copy does not change the caller’s variable.
For objects, the method gets a copy of the reference (the arrow). Both arrows point to the same object, so field changes are visible. If the method does obj = new Thing(), the caller’s arrow does not change.
The trap is saying “Java is call by reference”. It is not. It is call by value — the value of the reference is copied.
Let's take this on the board with one tiny Main class — no extra files. Output: Asha scored 72 then Pass. Real Main. Swap marks/name to show one idea from Call by Value and Call by Reference in Java. Start from main, go line by line, and stop at each print. That output is the proof for Call by Value and Call by Reference.
Say: Java is call by value. For objects the reference is copied, not the object.