Variables in java

Photo by Maximilian Weisbecker on

In this article we are talking about variables in java.

So what is a variable ? A variable is a 'place' in memory think of it like a 'box' if you will that you can store something in.
And the computer allows you to have hundreds or thousands of 'boxes', each containing
their own pieces of information.

So what we do with our variable ?
That 'box' is called a variable, and what we can do is we can assign the type of information
that we want to put into the boxes and we can also give it a name.

So why would we want to use variables ?
Well the reason that we want to use them, is because they make a program really useful.
If, for example, if there was a computer program that you wanted to create that helped calculate someone's current age based on the date, then of course you'd need to enter in their birthday, and the computer would need to store that somewhere, so it could then
calculate how old that person was. Without the ability to store something,
the computer wouldn't be able to process anything and the programs you create would be very very basic and not really useful. So a variable is used for that purpose, to store information.


Related posts