4.5. Conditional Logic

Conditional logic can be represented in Java much as you would represent it in CFScript. There are if/else constructs as well as switch/case constructs. Let's look at these in turn.

4.5.1. The if Statement

There is little difference between how you write an if/else block in Java from how you write it in CFScript. While the <cfelseif> tag can lead one to believe otherwise, there is no specific elseif statement; instead, you use else if.

4.5.2. Retirement.java

 /* shows use of if/else if, else * works very much as in <CFSCRIPT> */ // declare a new class called Retirement class Retirement { // the main method is the start point for program processing // it accepts an array of strings called "args" (arguments) public static ...

Get Java™ for ColdFusion® Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.