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

Показать описание
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
For Loops Explained and Common Pitfalls Highlighted
How to use the Shortcut Operators
Compare Objects - Equality Operator Vs Equals Method
Passing by Value (Object References)
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
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
For Loops Explained and Common Pitfalls Highlighted
How to use the Shortcut Operators
Compare Objects - Equality Operator Vs Equals Method
Passing by Value (Object References)
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