Final Variables

Sometimes when programming, we want to create variables that never change.
In Java, you can use the keyword final to make sure that your variables can't be changed.
It is a programming convention to make static and final variables all capital letters so that they are easy to identify in your code.

EXAMPLE:

double pi = 3.14159265359;

pi = 7.7; // This is perfectly valid.

System.out.println(pi); // This prints out 7.7.

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

final double PI = 3.14159265359; //notice we added "final"

PI = 7.7; //This will cause an error because PI had been labeled as final.

System.out.println(pi); // It still prints out 3.14159265359.