Java Tutorial - How to use Conditional Operator ( ? : )

Veröffentlicht am: 15 Mai 2015
auf dem Kanal: Martin O'Connor
4,704
80

How to use the Conditional Operator ( ? : ) in Java.

Hi Everyone and Welcome,

I am continuing on with my video series on Java programming for beginners. In this video, I motivate, introduce and illustrate with an example the conditional operator in Java (it is also known as the ternary operator). It is a very useful language construct that all beginners should know and love.

The conditional operator may be expressed as follows:

variable y = (boolean expression) ? value if true : value if false

The conditional operator allows us to write more succinct and legible Java code and is to be preferred over more length and wordy code.

I hope you find the video beneficial. If you have questions or feedback, please leave a comment below. Thank you!

WATCH SOME MORE JAVA TUTORIALS

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

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

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

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

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

Command Line Arguments
   • Java Tutorial - Command Line Arguments  

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

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

Passing by Value (Primitive Data Types)
   • Java Tutorial - Passing by Value (Primitiv...  

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

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

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

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

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

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

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

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

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


Auf dieser Seite können Sie das Online-Video Java Tutorial - How to use Conditional Operator ( ? : ) mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Martin O'Connor 15 Mai 2015 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 4,704 Mal angesehen und es wurde von 80 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!