Declaring Variables

Variables are declared by giving the type followed by a name:

int a;
String name;

They can be initialised in the same statement.

int a = 6;
String name = "Tom";

To define a constant value (that can't be overwritten) use the const keyword before the type.

const double pi = 3.14;