So as you can see here in this line of code I just declared this valuable and here I referred to the
name of my valuable and I assigned a value to my value.
And here I referred to this now free variable.
And I just create the value of this variable.
OK.
But if I for example want to refer to this are now very valuable here as you can see here now free.
OK.
As you can see it's not showing me an error.
So let's see what's this error.
Now free cannot be resolved as you can see here.
It's not recognizing there are no free variable.
OK.
Because I declared this now free variable in line 52.
OK.
And I am referring to this not everybody but in line 50.
So you must actually refer to a variable that was created before.
OK.
For example if I created this variable here I just can't refer to this the name of this variable here.
All the lines after the creation of this variable.
OK.
You can't refer to a variable before the creation of that variable.
Ok this is very important and I'll touch more about this concept later.
OK.
Now I'm going to talk about naming variables in Java.
OK.
So first let me comment about this line of code because I don't want to execute this statement any more.
First of all let me point out that in Java all variable names must start with a letter and underscore
character at the other side.
OK.
Variable names can not start with a number you cannot start your variable names with a number.
This is a very important point in name and your valuables after the first character variable names can
include any combination of letters numbers underscore characters or Dollar Signs.
OK now let me show you some real examples about naming variables in Java to make this concept more clear
for you.
OK so as you can see here I'm going to declare a variable here so the data type of my variable is int.
This ain't data type.
Here means that my variable holds an integer or a whole number.
OK so now I'm going to actually name my value.
So as I said earlier variable names in Java must start with the letter and underscore character or a
dollar sign.
OK so now I am going to actually start my variable name with the letter.
So for example a valuable.
Ok now I'm going to assign a value to my variable for example not per number 30.
OK so as you can see here I start at my variable name with a lowercase letter.
As you can see so this is a convention in Java that you should actually start your variable names with
a lowercase letter.
OK you can actually start your variable name with the uppercase letter as you can see here but it's
better to actually declare your variable names with a lower case letter.
OK because this is a convention in Java that you should always start your variable names with a lowercase
Slidder OK.
And as you can see here my variable name here starts with a lowercase letter.
So the first letter of the variable name is lowercase.
OK.
And each successive forth in the variable name begins with a capital letter.
So as you can see here this valuable vote here starts with a capital V OK and if I want to for example
add another vote here.
For example a variable name.
OK so let's see what happens.
As you can see I started this vort this and then vote here with a capital N. and all other letters are
lowercase.
So to recap as you can see here the first letter of the variable name is lowercase.
So this a letter is lowercase OK.
And each successive board in the variable name begins with a capital letter.
It is valuable word and this name vord begins with a capital letter.
As you can see here and all other letters are lower case.
So let me show you another example.
Again the data type is int and the variable name would be another
is declared here.
As you can see here.
This variable name is a very long name.
OK it is acceptable in Java that you actually write Longueval names.
If it is it is OK.
There is no problem about it and that I can't assign a value to my variable.
For example 23 and here are the first letter of my variable name begins with a lowercase letter and
each successive vote in the variable name begins with a capital letter.
OK this variable is declared here as you can see these.
Start with a capital letter OK.
And all other letters are lowercase.
OK this is a convention in Java that you should always actually name your valuables this way.
OK and let me show you another examples this time again the data type would be int here.
I'm going to start my variable name with the underscore character.
And again I need to actually start my other votes.
Each successive vote in the variable name with a capital letter.
Ok for example are there
and again I can't assign a value to my value.
It is OK to actually start your variable names with the underscore character.
And again I'm going to actually show you another example this time the data type is again integer Int.
And does that mean we're going to start my variable name with a dollar sign.
OK.
I can actually type in here other words for example dollar sign value.
And again I can assign values to my variable.
For example for free.
OK.
So as you can see here this variable name here starts with a dollar sign.
And each successive word in the value of a name begins with the uppercase letter.
OK.
So this is how you actually declare actually your variable names in Java and you should always as I
said before all your variable names must start with the letter and underscore character or a dollar
sign.
OK.
You can't actually start your variable name with the number.
So let me show you what's what's the problem with that.
With actually naming your valuables like that as you can see the data type is int and I'm going to actually
declare my variable name here.
For example 21 variable name J.
And then I can assign a value to my variable and then I just need to put a semicolon at the end of her
statement.
So let's actually run our project and here as you can see it says errors exist in required projects.
This project variables.
So we can't actually launch our project now.
There must be an error.
OK.
So as you can see here if I hover over my mouse pointer over the error area here as you can see it says
syntax error on token 21.
Delete this token.
So as you can see here it asks us to actually delete this number 21 at the start of our variable name.
So now let's just actually delete this number 21 at the start of our variable name and let's see what
happens.
And as you can see here now the error is gone.
And now I can actually run my project.
OK.
So if I for example want to output the value of this variable name to the canso I can just type in system
that out that print line.
And that inside the parenthesis.
I just need to refer to this variable name here.
Variable name
and that I just need to put a semi-colon at the end of our Actually statement.
OK.
So here I just need to run my project as you can see it's now actually showing us the number 42 on the
console here.
So the number 42 is the value of this variable name.
OK.
So that's it for variables.
I think that's enough for valuables.