Index

chapter1

chapter2page1

chapter2page2

chapter2page3

chapter2page4

chapter2page5

chapter2page6

chapter2page7

chapter2page8

chapter2page9

chapter2page10

chapter2page11

chapter2page12

chapter2page13

chapter2page14

chapter2page15

chapter2page16

chapter2page17

chapter2page18

chapter2page19

chapter2page20

chapter2page21

chapter2page22

chapter2page24

chapter2page25

chapter2page26

chapter2page27

chapter2page28

chapter2page29

chapter2page30

chapter2page31

chapter2page32

chapter2page33

chapter2page34

chapter3

link one

link one

link one

link one

link one

link one

2.6.7 - Numerical Comparison Operators

Numerical comparison operators are < (less than), > (greater than), <=, (less than or equal), >= (greater than or equal).

These operators are binary operators, their operands are primitive types or convertible to primitive types fails that, compile time error is generated. The action of these operators similar to each other and we will present them all together.

Comparison of integer and real data give absolutely reliable results. With integer data, signed integer comparison is performed. The reliability of signed comparison is out of any doubt. For real data, signed real comparison is conducted according to the IEEE 754 standard which states,

Application of numerical comparison operators is quite straightforward. One example is given below:

package preliminary;
public class NumericalInequality {
public static void main(String[] args){
int intNum = 389;
double dblNum = 1000.12;
boolean result = intNum < dblNum;
System.out.print(" Result = "  +  result));
 } // end main
} //end class NumericalInequality

The result of this program :

Result = true

Before the comparison, the data type of the left ope4rand is automatically promoted to double and the comparion is realized , the result is true because 389.0 is less than 1000.12.

<< Index

Polyglott HTML5(XHTML5 compliant HTML5 code)