Java for Testers #9 - What is Ternary Operator in Java

preview_player
Показать описание
In this Java for Testers tutorial we will learn what is Ternary Operator in Java. Ternary operator in Java functions like a simplified if-else Java statement.

The ternary operator "?:" accepts three operands (booleanExpression ? expression1 : expression2)

The first expression must be boolean expression, second and third are the expressions which can return any value. The Java Ternary operator returns expression1 if first boolean expression is evaluated to true and expression2 if first boolean operand evaluates to false.

Help me in spreading the knowledge, please hit LIKE, SHARE and SUBSCRIBE for latest tutorials. More tutorial playlists below:

🔶 ENROL IN MANY FREE TRAININGS ON RCV ACADEMY PORTAL 🔶

🔶 FOLLOW US ON TWITTER 🔶

🔶 LIKE US ON FACEBOOK 🔶

🔶 OUR TUTORIAL WEBSITES 🔶

🔶 GET MY TRAININGS ON UDEMY 🔶

#JavaForTesters #JavaForTestersTutorial #JavaBeginnersTutorial #JavaForSelenium #JavaForSeleniumTesters #TestAutomation #SeleniumWebDriverJava #RcvAcademy #SoftwareTestingMentor
Рекомендации по теме
Комментарии
Автор

Sir, your 'java for testers' series is enough for automation testing?

mayurdiwan
Автор

I have a question, can we use Ternary Operator for multple else-if statement?

ewelandadi
Автор

We might also simplify it to avoid setting data types to :

vladimirperfilov