TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Java Tutorials

Java Conditional Operators

Overview

In this tutorial, we will learn Java Conditional Operators. Conditional operators are also called as logical operators. These operators operate on boolean expressions.

Conditional Operators

Conditional Operation
Operator Symbol  Example
Logical AND

 

&& booleanExp1 && booleanExp2
Logical OR || booleanExp1 || booleanExp2
Ternary Operator ?:

 

The logical AND operator evaluates to true if both the boolean expressions are true, otherwise evaluates to false.

The logical OR operator evaluates to false if both the boolean expressions are false, otherwise evaluates to true.

The ternary operator uses three operands. It evaluates a boolean expression and if the boolean expression is true, the second operand is returned , otherwise, it returns the third operand.

For example:

output = booleanExp ? value1 : value2 ;

If the booleanExp evaluates to true the value1 is assigned to output variable. If the booleanExp evaluates to false the value2 is assigned to output variable.

—

Java Tutorials

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

For more information on Java, visit the official website :

https://www.oracle.com/java/

Related Posts

Download Greenfoot Windows

Java Tutorials /

Download & Install Greenfoot on Windows

Java Tutorials /

Java Static Code Analysis

Java Tutorials /

Java Testing Tools

Java Tutorials /

Handle Multiple Exceptions in Java

Exceptions_In_Java

Java Tutorials /

Exceptions in Java Programs

‹ Java Relational Operators› Java FileInputStream Class

Recent Posts

  • Update draw.io on Windows
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com