For example, assume we want to store two values 10 and 20 in our program and at a later stage, we want to use these two values. Let's see how we will do it.
Here are the following three simple steps:
- Create variables.
- Store values in those variables.
- Retrieve and use the stored values from the variables.
1. Creating variables
Creating variables is also called declaring variables in programming. Different programming languages have different ways of creating variables inside a program.
Example :
var x;
var y;
2. Store values
Example :
var x = 10;
var y = 20;
3. Retrieve and use
Example :
var x = 10;
var y = 20;
System.out.println(x+y);
Comments
Post a Comment