Passing by Value (Object References).
In an earlier video, I discussed a common difficulty that every beginner Java programmer encounters – does Java pass primitive data variables (i.e. int, float, char, boolean, etc) to method parameters by value or by reference. Recall Java *always* passes by value (passes a copy) and never by reference (passes the original).
In this video, I explain using examples how Java passes object references by value (that is to say – passes a copy of the object variables, arrays, etc) . In particular, I illustrate in detail how the passing by value of object references can exhibit behavior that is very similar to passing by reference (i.e. passing the original object memory address).
I hope you find this video beneficial. Please leave any comments or feedback in the comments section and I will respond as soon as I can. Thank you.
WATCH SOME MORE JAVA TUTORIALS
Enhanced For Loop Explained and Illustrated
For Loops Explained and Common Pitfalls Highlighted
How to use the Shortcut Operators
How to use the Conditional Operator ( ? : )
Compare Objects – Equality Operator Vs Equals Method
Command Line Arguments
How To Write A Method Part II
How To Write A Method Part I
Passing by Value (Primitive Data Types)
Division and Modulo Operators Explained
Operator Precedence Explained
What are Data Types, Variables and Constants?
How to use Nested If Statements
How to use simple If Statements
What are Control Flow Statements
How to Write, compile and run your first Java program on Windows
How to write, compile and run Java programs all within Notepad++
How to download and install the Notepad++ editor on Windows