Variables and DataTypes

1 / 3
Diagram of variables and datatypes.
2 / 3
Diagram of java variable datatypes.

In programming, variables are used to store data that can be referenced and manipulated throughout the program. Each variable has a data type, which defines the type of data it can store.


Common data types in Java include:



Java code example of variables.

Above are some code samples in java creating an integer, double, character, and float variables.


Quiz

  1. Create a variable named x that is an integer and has a value of 3.

  2. Create a variable named change that is a double and has a value of 5.07

  3. Create a variable named grade that is a character and has a value of A.