In: Computer Science
Variable type is the logical name given so that we can identify which variable can hold which kind of values. Along with type of value the variable can hold we can also determine the space required to store that data by using type information of the variable. There are many different variable types such as
1. int: used to store the Integer values
2. char: used to store a single character.
3.float: used to store the floating-point numbers.
4. double: It is also used to store the floating-point numbers but with more precision.
5. long: It is used to store the integer values but it can have almost double range than an integer that means it requires more space then integer.
6. boolean: this data type is used to store the true/false value. it's most common data type being used with the conditions.
Let's see an example of each of the data type;
1. Integer:
Declaration of the variable using the type
int a;
used to assign the value
a = 5;
2. Char:
char value = 'x';
char is used to hold a single character.
3. float: It's used to store the numbers with decimal points such as:
float a = 1.23;
so this will contain the values along with decimal points.
4. boolean: it can contain 2 values. true/ false such as:
boolean answer = false;
boolean checkValue = true;
Please let us know in the comments if you need further information.