/************************************************** * Author: Morrison * Date: 21 Oct 202020 * This program will illustrate some principles * of the final keyword and deliberately trigger * errors. Uncomment stuff that is commented out * so you can trigger the error yourself and * see it. As we progress this keyword will show up * in other areas. **************************************************/ import java.util.ArrayList; public class FinalExam { public FinalExam() { } public static void main(String[] args) { final int x = 5; //final means "can't be reassigned." //x++; COMPILER SCREAM final String urchin = "Charlie Brown"; final ArrayList al = new ArrayList<>(); al.add("Hello"); al.add("Greetings"); System.out.println(al); //al = new ArrayList<>(); COMPILER SCREAM final int[] arr = new int[5]; arr[0] = 5; arr = new int[10]; } }