And this is that this is more professional.
And now let's actually override the twisting method that you actually inherit from the superclass.
So what is the superclass.
In this case.
So as you know all classes in Java are explicitly or implicitly inherits all of the features and behaviors
that are inside of the Object class.
So he has this student student class as you can see here.
Implicitly inherits all of the features and behaviors that are inside of the Object class.
So here again just typing to string and here let's actually delete this line of code that are actually
inside that is inside of these two string method.
And now we can actually put in our own implementations inside of this posting method.
Now I'm going to actually pasting a line of code here and then I'm going to explain to you what's going
on here.
OK.
So here I am saying the return string data format and inside it up course as you can see I am specifying
the formats of my string value.
So this up.
So this person as you can see here is for this name here as you can see.
So a person as called space.
And we have another person is here this tokin is for these kids name it.
OK.
And we have a person here.
So this person is actually a newline character.
OK.
If we have another person here.
So this person is for this course name here.
OK.
Call in space.
And we have another person here and this person S is for this good course name here.
OK so now let's actually go back inside this main activity that double file here and inside of these
uncreate if it is actually putting our own coats here.
OK.
So first of all let's actually create an object from the text view class here as you can see here.
I am actually creating an object from this textbook class.
The polymorphism assignment operator and here I am saying find view by id r that ID data takes the polymorphism.
OK so now let's actually create an array of type of life insurance objects as you can see here.
This is a life insurance interface and inside of this main activity that have a fight and inside of
this uncreate Smurfette all you want to actually create an array of type life insurance.
So now I'm going to pasting some lines of code here and then I'm going to explain to you what's going
on here.
So here as you can see here first of all in 1919 I actually specify that I want to actually create an
array of type life insurance as you can see the name the name of this era is life insurance's assignment
operator.
And here I want to instantiate this array by saying that this area can actually accept free objects
of type life insurance.
OK.
And I agree that Chantry fair two are actually life insurance objects.
OK.
So the size of this area is free.
OK.
And here in line 20 as you can see for the index zero of this are a life insurance.
You want to assign a value.
OK.
So life insurance is sub index zero assignment operator new student.
So here I want to actually create an otter an object of type student.
New students.
So as you can see here inside of these students class as you can see this class because this class actually
implements this life insurance interface.
There is actually an ease our relationship between these two classes.
So student is our life insurance.
OK.
There is actually an is a relationship between these two between these student class and this life insurance
interface.
That is and is our relationship between these two this student class and these are life insurance.
OK.
So let's go back inside the main activity that I will fight here and here I created an object of type
student and here as you can see the constructor of this class is actually being called named John.
John the name of the student is John.
The course is Andrew devlopment.
And here this is the cost of the life insurance.
OK.
One thousand and here as you can see in line 21 for the index number of one of these are life insurance
is hourly here.
I created an object of type boxing.
OK.
So again as you can see inside of this boxing class this boxing class actually inherits all of the features
and behaviors that are inside of the sport class.
OK.
And this sports class actually implements this a life insurance interface.
So there is actually an is a relationship between displacing and this life insurance interface.
OK.
So let's go back and say this main activity that of a fight here.
He had actually created an object of type boxing and the constructor of boxing is actually being called
Boxing fighting by using only hands boxing uniform and these are the values for this for the constructor
of this boxing class.
OK.
And here for the index number two of these are life insurance as great as you can see here.
I created an object of type kickboxing.
So again because kickboxing actually inherits all of the features and behaviors that are inside of this
boxing class and this boxing class inherits all of the features and behaviors that are inside of this
sport class and this sport class actually implements this life insurance interface.
So this kickboxing and this are life insurance as you can see here.
There is and is our relationship between these kickboxing class and these life insurance interface.
So inside of this main activity that our fight here as you can see I can actually create an object of
type like sync as it can see and hear as you can see the construction of these kickboxing class is being
called kickboxing fighting by punching and kicking kickboxing uniform.
And these are the values for the constructed of these a kickboxing class as you can see here.
OK.
Now I'm going to actually paste in some lines of code here and then I'm going to explain to you what's
going on here.
OK.
So as you can see here these are the lines of code that they actually paste that here.
So first of all in line 29 I actually declared a string variable.
Ok all the polymorphism and then I actually created a for loop.
OK.
So this is actually an enhanced for loop.
And here I want to actually iterate over the values that are inside of this life insurance Aure.
OK.
So life insurance insurance object Colan life insurance says OK.
And inside of this a for loop as you can see here I am instantiating this all the polymorphisms variable
I just referred to the name of this valuable RTX the polymorphisms assignment operator here.
I actually referred to the name of this object that is of type text view.
So take the polymorphous at gettext that get text that are too strange.
Here I am getting the text of this RTX the polymorphous that takes you and I am converting that value
to our string body OK.
And then I am assigning value to this all the polymorphism value but that I actually declared in line
29 and in line 44 as you can see here.
I just referred to the name of this object to the polymorphism.
That said text string data format.
OK all the polymorphism Plus this value OK.
And here I am specifying the format the format of this string value Akkad person s.
So this person s is actually for these insurance object.
The twisting method.
Ok this specific insurance object that is actually inside of this life insurance says Adli.
OK.
So for example for the first time that this is going to be executed.
It's actually the insurance object is the object that is inside of the index zero of this life insurance
rate.
OK.
For example this students and then it's going I should call the twisting Meffert of this.
That is inside of this student class on this object.
And then as you can see here this is there another argument for this format as you can see here we have
person this person and this person is for this argument here.
Life insurance costs colon space.
We have a person here.
So an insurance object that evaluates cost of insurance.
So again you are calling to evaluate cost of insurance method that is specific to they actually object
to the specific object that is inside of this insurance.
Life insurance is free.
OK.
So for the first time that this group is going to be executed an object of type that is going to be
is going to be created.
And this evaluate cost of insurance if it is going to be called on this object.
OK so now let's actually run our project and see what happens.
So here as you can see our application actually crashed and let's go inside this lock here and let's
see what's the error.
OK.
So as you can see here inside of the slug it says Dava that you steal that illegal format's conversion
exception.
Personality cannot format's dotted at length that double.
OK.
So as I said before for double arguments we need to actually use percent f but mistakenly here we use
we use the person D.
So change this person to person F and then run your project again.
So as you can see here now our application is running on these our emulator here.
As you can see it's not named John coarsening Android development.
Life.
Life insurance cost disvalue name boxing rules fighting by using only Hanse uniform boxing uniform Spizz
requires 1000 power required.
Eight hundred.
Punching power required 2000 are punching speed requires 5000.
Life insurance costs are 6000.
And here you can see name kickboxing ludes fighting by punching and kicking.
Uniform kickboxing uniform speeds required 2000 power required.
If I wasn't a punching power required 4000 punching spit required 7000 Keech power required free thousand
and.
It requires 5000 and he had as you can see it says life insurance costs 2000.
OK so as you know inside of this kickboxing class I didn't overwrite this evaluate cost of insurance
Smurfit OK because I actually diskless actually inherits all of the features and behaviors that are
in sight of this boxing class.
And this boxing class actually provided an implementation for that method.
Ok this kickboxing class actually inherits that behavior.
Keep in head is that implementation and as you can see here it says life insurance costs are 2000.
OK as you can see here.
So hopefully that makes sense and if you have any questions please post the discussion in the course
and I'll do my best to answer all of your questions.
And thank you very much for watching and I'll see you in the next section.