Java Tutorial - Passing by Value (Primitive Data Types)

Veröffentlicht am: 12 Februar 2015
auf dem Kanal: Martin O'Connor
9,651
204

Passing by Value (Primitive Data Types)

Hi Everyone,

I am continuing on with my video series on Java programming for beginners. In this video, I discuss a common difficulty that every beginner Java programmer encounters - and that is - does Java pass variables to method parameters by value or by reference. This issue is known as passing by value versus passing by reference.

Java always passes by value and never by reference. That is to say, Java always passes a copy of a variable to a method parameter, and never a reference to the original variable itself.

Hence, any changes made to the copy of the variable in the method does not affect the original variable in any way. This is always true for primitive data type in Java. It is a little more complex when dealing with objects in Java and I will provide a video that focuses explicitly on that scenario and explain in detail what happens when objects are passes as parameters.

WATCH SOME MORE JAVA TUTORIALS

Enhanced For Loop Explained and Illustrated
   • Java Tutorial - Enhanced For Loop Exp...  

For Loops Explained and Common Pitfalls Highlighted
   • Java Tutorial - For Loops Explained a...  

How to use the Shortcut Operators
   • Java Tutorial - How to use Shortcut O...  

How to use the Conditional Operator ( ? : )
   • Java Tutorial - How to use Conditiona...  

Compare Objects - Equality Operator Vs Equals Method
   • Java Tutorial - Compare Objects - Equ...  

Passing by Value (Object References)
   • Java Tutorial - Passing by Value (Obj...  

Command Line Arguments
   • Java Tutorial - Command Line Arguments  

How To Write A Method Part II
   • Java Tutorial - How To Write A Method...  

How To Write A Method Part I
   • Java Tutorial - How To Write A Method...  

Division and Modulo Operators Explained
   • Java Tutorial - Division and Modulo O...  

Operator Precedence Explained
   • Java Tutorial -  Operator Precedence ...  

What are Data Types, Variables and Constants?
   • Java Tutorial - Introduction to Data ...  

How to use Nested If Statements
   • Java Tutorial - How to use If Stateme...  

How to use simple If Statements
   • Java Tutorial - How to use If Statements  

What are Control Flow Statements
   • Java Tutorial - What are Control Flow...  

How to Write, compile and run your first Java program on Windows
   • Java Tutorial - How to Write, compile...  

How to write, compile and run Java programs all within Notepad++
   • Java Tutorial - How to write, compile...  

How to download and install the Notepad++ editor on Windows
   • How to download and install the Notep...  


Auf dieser Seite können Sie das Online-Video Java Tutorial - Passing by Value (Primitive Data Types) mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Martin O'Connor 12 Februar 2015 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 9,651 Mal angesehen und es wurde von 204 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!