Variable types in Java
Hello Everyone
This is my first tutorial in java on cybertech
I'm this short tutorial I'm going to explain Java Variable types
********
What is a variable :
Variables are places in the computer's memory where you store the data for a program. Each variable is given a unique name which you refer to it with.
Variable types :
There are 3 different types of data that can be stored in variables. The first type is the numeric type which stores numbers. There are 2 types of numeric variables which are integer and real. Integers are whole numbers such as 1,2,3,... Real numbers have a decimal point in them such as 1.89 or 0.12.
Character variables store only 1 letter of the alphabet. You must always put the vlaue that is to be stored in a character variable inside single quotes. A string variable is like a chracter variable but it can store more than 1 character in it. You must use double quotes for a string instead of single quotes like with a character.
Boolean variables can store 1 of 2 values which are True or False.
Here is a table of the types of variables that can be used:
Code:
-Name - -Type- -Vaules-
byte Numeric - Integer -128 to 127
short Numeric - Integer -32 768 to 32 767
int Numeric - Integer -2 147 483 648 to 2 147 483 647
long Numeric - Integer -9 223 372 036 854 775 808 to 9 223 372 036 854 775 807
float Numeric - Real -3.4 * 1038 to 3.4 * 1038
double Numeric - Real -1.7 * 10308 to 1.7 * 10308
char Character All unicode characters
String Character All unicode characters
boolean Boolean True or False
If you have any question feel free to ask
:bye: