This is the name of our package.
I need to actually create another class.
So just click on this package here and then click on find new and then click on Java class.
So for the name of the class just type in here chat and then click on OK.
As you can see this is our catch class.
So just click on this package here again find new double class.
So for the name of the class just type in here like in OK is our legal class.
Again I want to create another class called Leppert.
So just click on this package here for my new job class and here just typing Lebert OK again I need
to create another class called Baird.
So just click on this package here and then click on find new and then click on job class.
So for the class name just type in here.
OK.
And then click on OK.
So as can see here I created all of these classes.
So now I can actually interact with these classes.
OK.
So now let's actually go inside the Animal class and as you can see here this is our Animal class.
So let's actually double click on this animal that you have here in order to make this a little elevator.
So as you can see here this is our Animal class.
And first let me point out that are all classes in Java up directly or indirectly inherit from the Object
class.
OK.
So as you can see here this Animal class actually inherits from the Object class.
So if I actually put this extents object here so as you can see here this object class is actually inside
the inside the Java that like package.
Ok here I am actually showing you that this animal class is actually inheriting all of the features
and behaviors that are inside this object class.
OK.
But if we actually don't put these two votes here that means that this animal class is actually inheriting
from the Object class.
OK you don't have to actually put this extends object here because that's UB by default or this animal
class is actually inheriting from this object class.
OK.
So let's actually go inside this object class and see the behaviors that are inside this object class.
So if you are using a match 6.
Just hold the command key and then click on object.
And if you are using a Windows machine you just need to hold the control key and then click on object.
So as you can see here this is our object class.
OK.
And here you can see the behaviors and the features that are inside this class.
Ok for example this Meffert equals or as you can see this is the constructor OK constructs a new instance
of Object.
OK.
And other methods that you can see here finalize.
OK.
So notify.
OK this is another method.
So let's actually close this class here.
And inside this animal class.
Now we want to actually put my implementation's my own coats inside this class.
Most of the program is actually taught or put.
These two votes here extends object because by default our class is actually inheriting from the object
class.
So we don't need to put these words here.
So not inside the curly braces I can put my own codes.
So now I want to create some instance variables inside these animal class.
So just type in here private as you can see the access modifier of my instance variable is private.
And here I want to specify that my variable is going to be a constant.
OK because I don't want to actually allow any other classes or methods to actually change the value
of this instance variable.
So I just need to put in the final keyword here.
And then I need to specify the data type of this variable as strange.
And then I need to give a name to this instance variable name.
So as you can see here I didn't assign any value to this instance variable because I don't because I
want to actually show you an important point about constructors in this tutorial.
So as you can see it's now shown as an error.
So let's actually Hulver our mouse pointer over the error area and see what's the added variable name
might not have been initialized.
So as you can see here it's complaining that we actually didn't assign any value to this instance variable.
OK.
So let's actually create another in another instance variable private.
And again my variable is going to be a constant find all the data type of my variable is strange and
the name of my variable is color.
OK.
And then I want to create another instance variable private.
Now I want to create another instance variable.
So the access modifier of my variable is private.
And here my value is not and constant.
So the data type of my variable is in it and the name of my variable is amount of speed.
And then I need to.
And then I need to put in a semi-colon at the end of my statement.
And again I want to create another instance variable private int I'm out of power.
OK.
So as you can see here these are the instance variables that I created inside these animal class.
OK.
And as you can see here because we didn't assign a value to these are constants here.
The Android studio is actually complaining.
So now I want to actually create a constructor for this animal class.
OK.
So first I need to specify the access modifier of my constructor public.
OK.
And the name of my constructor must be the same as the name of my class.
OK.
And.
And then I need to put in a pair of round brackets after my constructor name.
And then I need to open and close my constructor by using D-school curly braces.
OK.
So inside their practices here you want to specify that this constructor is going to actually accept
some arguments.
Ok so my first argument is of type as strange and the name of my argument is name.
OK.
My second argument is of type as three and again and the name of my argument is color.
My favorite argument is of type int and the name of my argument is amount of speed.
OK.
And again the later type of my argument is int and the name of my argument is amount of power.
OK.
So as you can see here these are the arguments that I specified for this constructor here.
OK so now I want to actually initialize these instance variables.
OK.
So in order to actually refer to these instance variables inside this constructor are you need to putting
this key vote here.
OK.
Because the name of this instance variable is actually the same as this as the name of this argument
here.
I need to put the key word this here in order to refer to this instance valuable insight this constructor.
OK so does that name assignments operator name ok.
Does that color assignment operator color.
OK so this color here actually refers to this instance variable and this color refers to this argument
here.
OK so because the name of this argument here is the same as this is the same as this instance variable
here.
I needed to actually put this key word here in order to refer to this instance variable.
Ok so this key vote here actually refers to this class.
OK.
So this thought color assignment operator color.
OK.
And again does that amount of speed.
Assignment operator I'm amount of speed.
Does that amount of power.
Assignment operator.
Amount of power.
And then I need to put in a semicolon at the end of my statement.
OK.
So as you can see here now the arrows are gone.
OK.
So here I initialized these instance variables and now the error is gone.
OK.
So whenever that I want to actually create an object from this animal class to this constructor it's
going to be called.
OK.
And then I need to specify a value for these instance variables.
OK if I don't actually specify any value for this instance variables I cannot create any object from
this animal class.
OK.
Because it is because this constructor is going to actually accept some values and that values is going
to be assigned to these instance variables.
OK so hopefully that makes sense.
Now I want to actually create the getters and setters for these instance variables because as you can
see the access modifier of these instance variables is private.
OK so I need to actually create some are Hera's or setters in order to allow other classes to actually
set or get the values of these instance variables.
OK.