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

Java

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/in/java/

Related Posts

Download Greenfoot Windows

Java /

Download & Install Greenfoot on Windows

Java /

Java Static Code Analysis

Java /

Java Testing Tools

Java /

Handle Multiple Exceptions in Java

Exceptions_In_Java

Java /

Exceptions in Java Programs

‹ Java Relational Operators› Checkstyle Source Code Analyzer Tool

Recent Posts

  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Print Triangle Pattern Flowchart
  • RAPTOR Editions
  • Flowgorithm Conditional Breakpoint Statement
  • Flowgorithm Read Numbers from File Example
  • Search Text File Flowchart Example
  • Flowgorithm Turtle Graphics Symbols
  • Draw Circle using Flowgorithm Turtle

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version