So as you can see here my object is now created.
So now I want to actually get the value of this instance valuable.
My fourth dark object.
So and then I had to actually output that value to the concert.
So I just need to type in here a system that out does princeling.
And then inside the prentices I referred to the name of my object my fourth dark thought get speed and
then I need to put in a semi-colon at the end of my statement.
So now if I run my project as you can see this is the value that is output to the console.
OK.
So this value as you can see here is the return value of this method here gets speed.
OK the value of this split instance variable is 70 OK but inside take it speed Mefford are you multiplied
that value by two.
And then I assigned that value to spit instance variable.
OK.
And then in line 11 I returned that value OK.
And as you can see here inside the console this is that value OK so 70 multiplied by two is one hundred
and forty.
This value is the returned value of the Smurfit.
OK.
So now let me actually show you another important point about these instance variables and these kids
here my friend.
OK.
So first let me actually change the access modifier of this instance variable to public.
And then inside the main method or you want to access the value of this instance variable directly.
OK.
So I just need to type in here system that out that princeling and then inside Apprentice's I just need
to refer to the name of my object my fourth dog that speed and then I need to put in a semi-colon at
the end of my statement.
So now if I had on my project as you can see the value of this instance variable is actually changed.
OK.
That this value is the value of this instance variable of this my fourth dog object.
OK you may ask that why this value is changed because inside get her my fed I multiplied that value
by two and then I assign that value to this instance variable.
So the value of this instance variable is now changed.
OK.
In line 11 I returned that value.
OK.
So that may actually change this to private.
OK so now I want to actually create a set for my fed for my speed.
Instance here.
So again the access modifier of my set and my Fed is public.
OK.
And the return type of this method is Voyt and the name of this method is set speed.
OK.
And then I need to put in a pair of round brackets here.
And inside the practices I want to specify that this method is going to accept an argument.
OK.
So the data type of my argument is it and the name of my argument is for example value.
OK.
And I want to open and close my method by using these curly braces so I insert the Smurfette.
I can actually do some changes with the value of the argument and then I can set that value to my speed
instance variable.
So let's see how we can do that.
First of all I need to refer to the name of my argument value and then I put an assignment operator
here.
And then again I refer to the name of my argument value plus five as you can see here I changed the
value of the argument here and I added 5 values to the value of my argument.
OK.
And then I assigned that value to this argument.
OK.
So now I can actually refer to the name of my speed instance variable and then I put an assignment operator
here.
And then I refer to the name of my argument.
So inside the main class here I want to actually set another value to that speed instance variable.
So first of all I need to refer to the name of my object my fourth dog that set speed.
So now I need to pass a value to this method.
OK.
So for example Number 10.
OK.
And now I want to actually output the value of this instance variable to the console.
So I just need to type in here system that out that princeling.
And then inside the prentices I need to refer to the name of my object and then I want to access the
value of this instance variable by using that term of it.
So I get speed and then I need to put a semicolon after my statement.
So now if I get on my project as you can see this is the value that is output to the console.
OK so now let me actually comment out this line of code here and let's run our project again.
As you can see.
So first of all the past number ten is set speed Meffert.
OK so inside that class.
So as you can see here inside this set speed method I specified that are you want to add five values
to the value of the argument.
OK.
And then I assign that value to that argument.
And then in line 15 I assign the value of that argument to that speed instance value.
OK so now that I actually passed the number 10 to the Smurfette number 10 plus 5 is 15.
OK so now the value of this instance variable is 15.
OK but in line 48 inside the main class and inside the main method I decided to output that value to
the console.
So I deferred the name of my object and then I used this dot notation here and then I actually tried
to access the value of this instance variable by using this good speed method.
OK so now let's go inside the get speed method.
So as you can see here this is our good speed method.
So the value of the speed instance variable is 15.
OK so 15 multiplied by 2 is 40.
So the value of this instance variable is now 50.
And then in line 11 I returned.
That's right you.
So the value of this instance variable is now 40.
So as you can see here inside the console this is the value of our speed instance variable.
OK.
So I think that's enough for this tutorial.
And in the next tutorial.
And when I talk about class variables and how we can use the class methods in our Java codes.
OK.
So thank you very much for watching.
And if you have any questions please post the discussion in the course and then I'll try my best to
answer your questions.