1. Technology

Relational Operator

By

Man using laptop
Lane Oatey / Blue Jean Images/Collection Mix: Subjects/Getty Images
Definition:

A relational operator compares two operands to determine whether one is greater than, greater than or equal to, less than, less than or equal to the other:

 >    greater than
 >=   greater than or equal to
 <    less than
 <=   less than or equal to
 

When used in an expression they all return a boolean value which states the result of the comparison (i.e., 4 > 3 can be read as is 4 greater than 3? Which returns true).

Examples:
 int three = 3;
 int four = 4;
 
 //is four greater than three?
 System.out.println(four > three); //true
 
 //is four greater than or equal to four?
 System.out.println(four >= four); //true
 
 //is four less than three?
 System.out.println(four < three); //false
 
 //is four less than or equal to three?
 System.out.println(four <= three); //false
 

Glossary:

# A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  1. About.com
  2. Technology
  3. Java
  4. Java Glossary
  5. R
  6. Definition for the Term: Relational Operator

©2014 About.com. All rights reserved.