And this is the address of this my life an object inside the memory.
OK.
So now that my object is created all you want to actually access its characteristics and behaviors and
then output them to the console.
So now I just need to type in here sister data out that print to learn and that inside the prentices
I just need to refer to the name of my object my lion and then I want to access its speed instance valuable.
So I just use the dot notation here and then I choose this instance variable.
And then at the end of my statement I need to put in a semicolon and if I get on my project.
Now as you can see this is the value of this instance variable of this specific object.
OK.
So the value of this split instance variable is 90.
OK.
And now I want to output the value of the power instance variable of this object.
OK.
So here I just need to typing system that out that print learn and then inside the prentices I just
need to refer to the name of my object and then I use the dot notation here in order to access the power
instance variable.
Ok power.
And then at the end of my statement I need to put in a semi-colon and if I get on my project now this
value is the value of the power instance variable of this specific object.
OK my lawyer an object.
OK so now I want to actually access the behaviors of my lawyer.
OK.
So first I need to refer to the name of my object and then I use the dot notation here.
And then I want to actually tell my lawyer to roll.
OK.
So I just need to take in her role as you can see here in this line of code in line 14.
I am telling my lawyer object to roll.
OK.
So now if I run my project as you can see this is the value that is output to the console okay.
Or I may want to actually tell my lion to run.
OK.
So I just need to refer to the name of the object.
And then I use the dot notation here and then I tell my client to run.
OK.
So now if I run on my project as you can see this is the value that is output to the console run ok.
For example my line is now running OK.
And then I want to tell my lawyer to actually fight.
OK.
So again I need to refer to the name of my object that fight and if I get on my project.
Now as you can see my lion is actually fighting now OK.
This is the value that is output to the console fight.
OK.
Or I may want to actually tell my lawyer to sleep so I just need to refer to the name of my object my
lawyer and that sleep.
And if I run my project now as you can see this is the value that is outputted to the console.
For example my lion is now sleeping.
OK.
So first my line is going I actually wrote and then it's going to run and then it's going to fight.
And then my line is going I should sleep OK.
So this is how you can actually access the characteristics or instance variables and the behaviors of
your objects.
OK.
So now let me show you another example.
So first let me actually comment out these lines of code here and here I can actually create another
object of this class.
So I just need to refer to the name of my lion class and the name of my lion object is my second lion.
And then I put an assignment operator here and then I use this keyboard here new and again I need to
refer to the name of my class and that I need to put in a pair of round brackets after my class name
OK.
And then I need to put in a semicolon at the end of my statement.
So now I can actually access the instance variables or behaviors of these.
My second line object.
OK.
So now I want to show you another way of creating objects so like variables we can first declare our
objects.
So now as you can see here in 9:19 I am actually declaring that I am going to create an object from
the lower class.
OK but I didn't actually instantiate this object.
OK.
First before I can actually access the characteristics or behaviors of these Lalia object I need to
first instantiated.
So for example in line to anyone I can instantiate my search like an object I need to refer to the name
of my object.
My second luggin and I puts an assignment operator here and then I put this key word here new.
And then I refer to the name of my class and then I put a pair of round brackets at the end of my class.
OK.
So as you can see here now in line 21 I am actually instantiating my second line object.
OK.
And now I can access the characteristics or behaviors of DS.
My second like an object.
OK.
So I can just take in here system that out that learn and then inside the apprentice's I can just refer
to the name of my object that speed
I want to output the value of the power instance variable to the console.
So I just need to type in here system that out that print to learn and that in say the apprentice's
I need to refer to the name of my object my second life and that power or I may want to access the behaviors
of my life and object.
So I just need to refer to the name of my object my my second line that wrote my second line in thought
Ron my second lie in that fight my second life in that sleep.
So as you can see here I successfully managed to actually access the characteristics and behaviors of
my life and object.
OK.
So now if you are on my project as you can see these are the values of the characteristics or behaviors
of my second line object.
OK.
So now if I actually comment out this line of code here now the eclipse is complaining and is now showing
us lots of errors.
OK.
It's telling us that we need to actually instantiate our object before we can actually access the instance
variables or behaviors of that specific object.
OK so in line 21 we are actually instantiating and it's my second layer and object.
OK.
So that's it for actually objects and methods and that's how you can actually access the characteristics
or the behaviors of your objects.
OK.
So if you have any questions please post the discussion in the course.
Thank you very much for watching and I'll see you in the next tutorial.