Home Segments Top Top Previous Next

389: Mainline

The layout of nested if statements is a matter of convention. Here is another common arrangement:

public class Demonstrate { 
 public static void main (String argv[]) { 
  int length = 95; 
  if (length < 60) 
   System.out.println("It is short!"); 
  else if (length > 90) 
   System.out.println("It is long!"); 
 } 
} 
--- Result --- 
It is long!