Mega Code Archive

 
Categories / Java Book / 001 Language Basics
 

0037 Relational Operators

The relational operators determine the relationship between two operands. The relational operators are: Operator Result == Equal to != Not equal to > Greater than < Less than >= Greater than or equal to <= Less than or equal to For example, the following code fragment is perfectly valid: public class Main { public static void main(String[] argv) { int a = 4; int b = 1; boolean c = a < b; System.out.println("c is " + c); } } The result of a < b (which is false) is stored in c. c is false