Variables are used to store information that can be referenced and manipulated in a program. In Apex, you declare a variable by specifying its data type and a name.
// Declare a variable of type String String myName; // Assign a value to the variable myName = 'John Doe'; // Declare and initialize a variable in one line Integer myAge = 30;