// Grade.java -- A Java program illustrating "if" public final class Grade { private static final int[] CUT_OFFS = {60, 70, 80, 90}; public static void main (final String[] args) { final int score = Integer.parseInt (args[0]); final char grade; // "blank final" if (score >= CUT_OFFS[3]) { grade = 'A'; } else if (score >= CUT_OFFS[2]) { grade = 'B'; } else if (score >= CUT_OFFS[1]) { grade = 'C'; } else if (score >= CUT_OFFS[0]) { grade = 'D'; } else { grade = 'F'; } // N.B. All cases must be handled or analysis would yield // an error: "Variable 'grade' may not have been initialized." System.out.printf ("The grade is %c.%n", grade); } }