/************************************************** * Author: Morrison * Date: 23 Oct 202020 **************************************************/ import java.util.ArrayList; public class FinalExample { public static void main(String[] args) { final int x = 5; //x++; this is a no-no. // final variables of primitive type are const. final String animal = "cat"; //animal = "dog"; reassigment is illegal here. final ArrayList foo = new ArrayList<>(); foo.add("new item number 1"); //a final variable pointing at a mutable object //can change the state3 of the object. This is //not constness. } }