So in this way we did manage to concatenate these two string values together and here as you can see
in the emulator these values are together here.
OK.
The name of my child is my child.
So let's actually go inside this main activity that Java here as you can see the name of my child is
my charts the color of my child is white the speed of my child is 40.
The power of my child is 40 and the number of legs of my child is four and fight two.
So hopefully that makes sense.
And here inside is Kathe class as you can see of vidit use the power of inheritance in our class.
OK.
So please make sure that you write your codes in this way.
If you want to be a professional and whatever will appear or if you want to actually apply for your
dream job as an Android Developer and actually earn top money please write your code in this way.
You need to actually to write your cards in this way in order to persuade the employers to employ you.
OK.
If you write your code in this way everybody wants you to write that applications.
OK.
Because this way of writing code is the most professional way of writing good code.
OK.
So now let's actually go inside this Animal class and here let's actually create another method.
OK.
So the access modifier of this method is public and the return type of this method is it and the name
of this method is evaluate Alamein value.
OK.
And that I put a pair of brackets after the name of that name.
And then I open and close the Smurfette by using these curly braces.
So now I want to actually return a value that specifies the animal's value.
OK first let's actually create an integer variable and the name of this variable is the result.
And then I put an assignment operator here and then I specify the value of our animal by actually multiplying
the value of this amount of speed instance variable by the value of this amount of power instance variable.
OK.
So amount of speed instance variable multiplied by amount of power instance variable.
And then I return disvalue return result.
OK so now as you can see we've got this method inside this animal class and this cad's class actually
inherits all of the features and behaviors that are declared as public.
Inside the Animal class.
OK.
So I can actually access that method here.
OK.
So let's actually access that method.
And here we can actually again concatenate this value here with another value.
So plus operator evaluates animal value.
OK.
So as you can see here we did manage to concatenate this value with other strings here.
OK.
So as you can see here inside this Animal class the Smurfette returns a value of type integer and in
Java we can actually concatenate string values with integer values.
OK.
So as you can see here we poods this plus operator in order to concatenate is string value.
With this we have returned value of the Smurfit evaluate animal value.
And if I had on my project.
Now let's see what happens.
So as you can see here now this value is outputted here.
OK.
Twelve hundred.
OK.
So at least 12 hundred is the result of multiplication of these are two numbers.
Number 40 multiplied by number 30.
OK so this number 40 here is the value of this speed amount of speed instance variable and this number
first here is the value of this power instance variable and we multiplied these two values together
in order to actually specify the animal's value.
OK twelve hundred.
OK.
So here I can actually inside this math class I can actually specify what this number relates to by
just actually putting another plus operator here.
And then I can put a strain of value here a string literal.
And here I can't just save an animal value OK or chat's value.
It doesn't really matter.
And then I can actually put in a call in here and another space here.
And let's actually put another space here in order to separate these values here.
So let's actually run our project again and see what happens.
OK.
As you can see now disvalue is outputted Hiroki animal value.
Twelve hundred.
OK.
So hopefully that makes sense.
And now we want to actually talk about another axis modifier.
So inside this animal pass as you can see we've got these are private instance variables and this math
class which inherits all of those instance variables and methods I cannot see those private instance
variables.
OK.
So there is a solution for that.
OK.
You can actually use the protected access modifier in order to allow the subclasses or the classes that
inherit from this class to actually access these instance variables.
So let's see how we can do that.
OK everyone.
Now as you can see this instance variables are declared as private.
Instance variables are OK.
The access modifier of this instance variables is private.
So inside this Kathe class you might actually create another method.
OK.
Public stream the return type of this method is strange and the name of this line if it is our poods
some values to the screen.
Ok for example.
And then I put up around brackets after my method name and then I open and close my method by using
these curly braces.
So inside the Smurfette I want to actually put my own implementations inside the Smurfette.
OK.
So here I can just type in return and then I can just put these two double quotes here.
So as you can see here we need to actually return a value of types three in here.
Ok this may affect the return type of the Smif it is string.
So return and as against the inside of double quotes I can just type in name colon and then plus operator
and then I want to actually to access the name instance variable that is declared inside this Animal
class.
OK.
So as you know this math class here is actually inheriting all of the features and behaviors that are
inside this Animal class.
So you can actually access the instance variables that are inside this animal class.
But because this instance variables are declared as private I cannot see this instance variables these
instance variables are still part of this chat class.
OK but I cannot see them.
OK.
When you declare your instance variables or your methods as private data class that contains all those
private parts has complete control over those private parts of that class.
OK.
So this animal class actually has complete control over these private instance variables and this cat
class can not see those are private parts that are inside this Animal class.
So here in this chat class inside this output some values to the screen Meffert.
You want to actually access the value of the name instance variable.
I can just typing get a name.
OK so are I assure you that you can actually use our diskettes name in order to access the value of
the named instance variable.
But there is another way that we can actually access those private parts of that class.
OK.
So as you can see here this Animal class in this Animal class these are the private parts we have and
other our access modifier called Protector's.
OK protected this protected access modifier is just like private's.
It actually allows the subclasses of this superclass this animal class to access these private parts
that are inside of this animal class.
OK.
So inside this cat class I can just refer to the name instance variable that is declared inside this
animal class because I use this protected access modifier.
So this access modifier actually allows us actually allows other classes that are subclasses of this
animal class to access these instance variables.
OK.
Only subclasses can access this instance variable.
Ok the cat class is actually related to this animal class so I can actually access this named instance
variable OK because we are inheriting all of the features and behaviors that are inside these Animal
class.
OK.
So let's actually change the access modifier of Ds are instance variables to protected.
And here I can just take and protected.
And here again just like in Protector's.
OK.
And then inside is chat's class as you can see.
Now I can actually access those instance variables directly.
OK.
But this is not the proper way to allow other classes to access your instance variables.
OK.
Always allow the other classes to access the value of your variables by using those getters and setters.
OK.