What are Variables in Java ?
Variables in any programming language are like containers for storing any type of data. Variables helps us to save the data inside them. Variablesare used to store data during the execution of the program.
When we store data in a variable then the specified data is stored in the ram with specified name. The variable name is actually the name of the memory location.
There are different types of variables in Java Programming language.
int - stores integers
float - stores floating point numbers
char - stores text such as 'c' or 'C'
String - stores text such as 'CuriosBaba'
boolean - stores values with two types - true of false
Declaration of Variables in Java
When we want to store data, the first step is to declare a variable in java. Variable declaration consists of 2 components.
When we declare a variable, an empty space is allotted in RAM with the specified name. In this case 'num'
-min.png)
-min.png)
-min.png)
0 Comments