A declaration statement is used to declare a variable by specifying its data type and name. For example, the following three declaration statements declare int, boolean and String variables:
int number; boolean isFinished; String welcomeMessage;
In addition to the data type and name, a declaration statement can initialize the variable with a value:
int number = 10; boolean isFinished = false; String welcomeMessage = "Hello!";
It's also possible to declare more than one variable of the same data type in one declaration statement:
int number, anotherNumber, yetAnotherNumber; boolean isFinished = false, isAlmostFinished = true; String welcomeMessage = "Hello!", farewellMessage;
The variables number, anotherNumber and yetAnotherNumber all have int data types. The two boolean variables isFinished and isAlmostFinished are declared with initial values of false and true respectively. And finally, the String variable welcomeMessage is assigned the String value of "Hello!", whilst the variable farewellMessage is simply declared as a String.