Watch everyone now in this tutorial we're going to actually go ahead and continue building our fourth
Android application.
So as you can see here here we actually see some errors.
Ok the Android studio is complaining.
And we need to actually first fix these errors in order to actually run our application.
So let's actually fix this our first error here.
As you can see here let's actually hover our mouse pointer over this error area and see what's the error.
As you can see here it says there is no default constructor available income.
That example that maters I saw that that app for that animal.
OK.
It refers to this animal class here.
OK.
So it says that there is no default constructor here and it's right because we actually created a custom
constructor in this class as you can see here this is Arkan's custom constructor.
OK.
So then we actually create a constructor in our class.
The compiler doesn't provide a default constructor for us.
OK.
So when you actually create a cost a constructor in the Animal class need to actually implicitly or
explicitly call the constructor of the superclass.
OK so now we are inside the scope of this animal class here.
OK.
And this animal class extends from the Object class.
And this means that this animal class inherits all of the features and behaviors that are inside of
this object class into this Animal class.
OK.
So this class inherits all of that features that are inside this object class.
OK.
So out the inside the object class which is a predefined class in Java.
We've got our constructor.
So let's actually go inside the object class and see and find that constructor OK.
So I need to actually hold the command key and then click on this object here.
And if you are using a Windows machine you need to actually hold the control key and then click on the
object.
OK.
So as you can see here this is the constructor inside this object class.
OK.
And this comment says constructs a new instance of Object.
OK.
So as you can see here this is the constructor and this constructor doesn't actually accept any arguments.
And as you can see here there is no implementation inside this constructor OK.
So let's go back inside the Animal class as you can see here.
Here we need to actually implicitly or explicitly call the constructor of the superclass because you
are actually inheriting all of the features of this object class into the Animal class.
The compiler does provide a default constructor for us.
OK.
The default constructor that is inside of this object class.
Remember that a default constructor is a constructor without no parameters.
OK.
And the constructor that is inside this object class has no promotors.
OK.
So inside this Animal class because we are inheriting all of the features of this object class into
this Animal class the compiler does provide a default constructor for us.
OK so we don't need to actually explicitly initialize initialize the constructor of the superclass.
OK so the superclass is object.
OK.
And inside the Animal class we don't need to explicitly initialize that constructor that is inside this
object class.
OK the compiler does provide a default constructor for us but inside this cat class as you can see here
there is another story here.
Here in this class in the scope of this class we are actually extending all of the features that are
inside of this animal class into this chat class.
OK.
We are inheriting all of the features and behaviors that are declared as public entities Kathe class.
OK.
So inside this Animal class let's actually hold the command key and then click on animal here.
As you can see this is an Animal class.
OK.
Inside this class I have a custom constructor here.
I created my own constructor for this animal class.
So inside this chat class we need to actually initialize the constructed of the superclass So the constructor
of the superclass is this constructor OK.
So inside the constructor of this Chadha class we need to initialize the constructor of the superclass
otherwise the compiler is going to actually complain and we would not be able to run our application.
So in order to initialize the constructor of the superclass which is this animal class I just need to
type in here super.
OK.
And then inside the apprentice's as you can see here.
I need to actually passing some values.
OK.
Let's actually hover our mouse pointer over this error area and see what's the error.
It asks us to actually passing some values for the next instance variable and a value for.
For the color instance variable of value for the amount of spit instance variable and of value for the
amount of power or instance variable.
Ok you may wonder that Verity's or instance variables come from.
We don't have these instance variables in this chat class.
So why do this construct and asks us to actually Pessin our values for these instance variables.
Because you are actually inheriting all of the features of this animal class into this math class Vini
to actually initialize those instance variables too.
So inside this animal class as you can see here we've got this instance variables here.
OK.
In say the cat class we are actually inheriting all of these instance variables and methods.
OK.
But as you can see here these instance variables are declared as private.
OK this instance variable is honestly part of the child's class instance variables are not visible to
this class.
Ok to this chat class because.
Because this instance variables are declared as private.
OK.
So we need to actually pass some values to this superclass constructor in order to actually fix these
errors.
OK.
So how can we actually initialize those instance variables in this class class.
We need to actually provide some arguments inside the prentices of the constructor of this Kathe class.
Ok so here.
Now I want to actually provide some arguments and then I want to actually assign those arguments to
the instance variables of the superclass which is the animal class.
OK.
First of all I need to provide a value for this strange named instance variable here.
OK.
Of types thrain in order to actually initialize the named instance variable OK.
So the cat class.
First of all I need to actually specify the data type of my argument.
Strange.
OK.
And the name of my argument is name.
Now I need to actually provide another argument for the coloring instance variable as you can see this
is our color instance variable.
So as you can see here we've got this color instance variable but this is an argument for this color
instance variable.
So inside the cat class and inside the Prentice's of this constructor I need to actually provide an
argument for the color instance variable Strunk color comma and then I need to actually provide an other
argument for this amount of speed here.
Amount of speed instance variable here.
OK.
So inside the Kathe class I need to actually create another argument in amount of speed.
OK.
Come on.
And then I need to actually provide another argument for this amount of power instance variable.
OK.
As you can see we've got this amount of power argument here and here we are actually assigning this
argument to this instance variable here.
OK.
So in say the cat class you need to actually create another argument in amount of power.
OK comma so now inside the Prentice's of this super here I can actually pass these arguments here.
OK so name comma color comma amount of speed comma amount of power.
OK.
So as you can see here now the error is gone.
OK.
We don't see any error here.
OK.
Because we actually successfully initialized the constructor of the superclass.
OK.
So as you can see here inside the Animal class this is the constructor of the superclass and this constructor
actually exits for arguments.
OK.
And inside the cat class you are actually passing D's of value for those four arguments here.
OK of value for the name instance valuable value for the color instance variable of value for the amount
of instance variable and a value for the amount of power instance variable.
So here we are actually explicitly calling the constructor of the superclass.
OK.