Learn Java for Web Development

(Tina Meador) #1
CHAPTER 3: Best Practices in Java EE Web Development 111

Listing 3-6. Arithmetic Operators



























Arithmetic Operator Boolean Result
${'${'}2 + 2 } ${2 + 2}
${'${'}2 - 2 } ${2 - 2}
${'${'}2 * 2 } ${2 * 2}
${'${'}2 / 2 } ${2 / 2}
${'${'}2 mod 2 } ${2 mod 2}

Figure 3-2. Arithmetic operators


Relational Operators


These operators include ==, !=, <, >, <=, >=, eq, ne, lt, gt, le, and ge.


Listing 3-7 illustrates all these operators. You can use this code on a JSP file and run it on the server.
The output is illustrated in Figure 3-3.


Listing 3-7. Relational Operators






Relational Operator Boolean Result