1
00:00:00,120 --> 00:00:03,500
But as you know a lion is actually an animal.

2
00:00:03,510 --> 00:00:03,960
OK.

3
00:00:04,110 --> 00:00:10,740
So I can actually inherit all of the features and behaviors that are actually inside of the Animal class

4
00:00:10,950 --> 00:00:13,340
so extends animal here.

5
00:00:13,860 --> 00:00:21,000
And these are the instance variables that are specific only to display in class privates Boullion can

6
00:00:21,000 --> 00:00:22,010
fight too.

7
00:00:22,080 --> 00:00:23,170
OK.

8
00:00:23,250 --> 00:00:24,450
And here I created.

9
00:00:24,450 --> 00:00:32,220
I actually did declare an instance variable private int fighting power and as you can see here I didn't

10
00:00:32,280 --> 00:00:35,640
instantiate this instance variable here.

11
00:00:35,640 --> 00:00:36,420
OK.

12
00:00:36,420 --> 00:00:40,960
Now let's actually create a constructor for this like in class here.

13
00:00:41,060 --> 00:00:45,930
OK so now I'm going to have truly pasting this constructive and then I'm going to explain to you what's

14
00:00:45,930 --> 00:00:47,100
going on here.

15
00:00:47,550 --> 00:00:51,150
So as you can see here this is the constructor that I actually pasted here.

16
00:00:51,330 --> 00:00:51,950
OK.

17
00:00:52,530 --> 00:00:58,470
And here you can see that as you can see the Axis modifier of this kind of structure is public.

18
00:00:58,740 --> 00:01:03,160
The name of this constructor must be the same as the name of this class.

19
00:01:03,220 --> 00:01:03,990
OK.

20
00:01:04,290 --> 00:01:08,900
And here as you can see this constructor actually accepts some arguments.

21
00:01:08,900 --> 00:01:13,800
Ok the first argument is of types 3 an animal name.

22
00:01:13,800 --> 00:01:16,270
The second argument is of type against string.

23
00:01:16,590 --> 00:01:19,940
Animal color into power in speed.

24
00:01:20,190 --> 00:01:23,130
And here as you can see Boullion can fight.

25
00:01:23,210 --> 00:01:23,750
OK.

26
00:01:24,030 --> 00:01:26,150
And it fighting power.

27
00:01:26,460 --> 00:01:31,620
So here because we are actually inheriting all of the features and behaviors that are inside of this

28
00:01:31,620 --> 00:01:38,790
animal class we need to call it actually the constructor of the superclass or Keaveney to actually initialize

29
00:01:39,150 --> 00:01:41,000
the constructor of the superclass.

30
00:01:41,010 --> 00:01:42,090
So as you can see here.

31
00:01:42,120 --> 00:01:43,040
Super.

32
00:01:43,220 --> 00:01:43,790
OK.

33
00:01:43,910 --> 00:01:47,520
See this super actually refers to the superclass animal.

34
00:01:47,630 --> 00:01:51,900
OK here you want to initialize the constructor of the superclass.

35
00:01:51,900 --> 00:01:52,210
OK.

36
00:01:52,260 --> 00:01:54,350
So super animal name.

37
00:01:54,540 --> 00:01:55,090
OK.

38
00:01:55,380 --> 00:02:01,200
So this animal name as you can see animal inside of the Animal class we have this constructor here.

39
00:02:01,200 --> 00:02:01,580
OK.

40
00:02:01,710 --> 00:02:08,100
So this constructor as you can see the first argument that this animal constructed actually accepts

41
00:02:08,400 --> 00:02:10,420
is of type strange animal name.

42
00:02:10,470 --> 00:02:10,900
OK.

43
00:02:10,980 --> 00:02:14,110
So inside of this lion class I am actually assigning.

44
00:02:14,120 --> 00:02:20,490
That's why you here to that to that instance variable that is inside this animal here inside of these

45
00:02:20,790 --> 00:02:21,870
Animal class.

46
00:02:21,900 --> 00:02:22,330
OK.

47
00:02:22,410 --> 00:02:30,510
So like an animal named animal color as you can see here power and speed here.

48
00:02:30,720 --> 00:02:36,590
And these are these two instance variables as you can see here these can fight in Cincinnati.

49
00:02:36,870 --> 00:02:42,800
And these fighting power is actually these are actually specific only through this low class sort of

50
00:02:42,810 --> 00:02:45,680
chant fight and fight in power here as you can see.

51
00:02:45,810 --> 00:02:49,400
First of all I created an if statement here.

52
00:02:49,500 --> 00:02:49,970
OK.

53
00:02:50,040 --> 00:02:52,950
If the value of this fighting power.

54
00:02:53,200 --> 00:03:01,290
OK if the value of the swanking power arguments is less than or equal to number 0 then of throw on you

55
00:03:01,560 --> 00:03:08,940
actually exception for new argument exception the value of the argument the power must be greater than

56
00:03:09,150 --> 00:03:11,550
number zero as you can see here.

57
00:03:11,610 --> 00:03:12,060
OK.

58
00:03:12,060 --> 00:03:19,320
And here as you can see I am instantiating these actually these instance variables these that can fight

59
00:03:19,530 --> 00:03:26,000
assignment operator can fight the start fighting power assignments operator fighting and power.

60
00:03:26,010 --> 00:03:33,190
OK so now let's actually create some are getters and setters for these instance variables.

61
00:03:33,210 --> 00:03:40,140
So here inside of this class I just would like to click here and then you can generate and then click

62
00:03:40,140 --> 00:03:47,380
can get here and sit here and here choose these two instance variables and then click on OK here.

63
00:03:47,430 --> 00:03:53,880
So as you can see here these are my instant actually these are my getters and setters for these two

64
00:03:53,880 --> 00:03:59,640
instance variables as you can see here up is can fight said can fight.

65
00:03:59,670 --> 00:04:02,880
So I don't like this name here is can't fight.

66
00:04:02,880 --> 00:04:06,730
So I just did it this is here and I can just type in jets.

67
00:04:07,010 --> 00:04:12,310
Gays can fight so it can fight get fighting power and set fighting power.

68
00:04:12,390 --> 00:04:12,750
OK.

69
00:04:12,780 --> 00:04:20,580
Let's actually up to calculate Meffert as you can see we have another addendum if you calculate the

70
00:04:20,580 --> 00:04:23,110
overall power of animal method here.

71
00:04:23,130 --> 00:04:28,860
So because this lion class actually inherits all of the features and behaviors that are actually inside

72
00:04:28,860 --> 00:04:34,370
of this animal class I can override that method here so I can just I can calculate.

73
00:04:34,530 --> 00:04:39,960
And as you can see I can refer to the name of that method here and that if I press enter here on my

74
00:04:39,960 --> 00:04:42,720
keyboard now you can see this left here.

75
00:04:42,870 --> 00:04:45,710
It calculates the overall power of any man.

76
00:04:45,990 --> 00:04:51,880
And here as you can see it says Return superior that calculate the overall power of any man.

77
00:04:52,050 --> 00:04:59,740
So again just put a A-plus operator here and then I'm going to actually putting the fighting power here.

78
00:05:00,030 --> 00:05:05,810
In power as you can see here this superhero actually refers to the name of the superclass animal.

79
00:05:06,100 --> 00:05:12,970
This calculates the overall power of animal if it actually is going to execute this line of code here

80
00:05:13,390 --> 00:05:17,940
gives animal power multiplied by the value of the animal speed.

81
00:05:18,340 --> 00:05:22,820
And then I am actually adding the value of this fighting power to that value.

82
00:05:22,840 --> 00:05:23,370
OK.

83
00:05:23,500 --> 00:05:26,750
And then I am returning that value to the call to the call of the spec for it.

84
00:05:26,770 --> 00:05:32,820
OK so now let's actually override the two string method that is inside of the superclass of this in

85
00:05:32,840 --> 00:05:33,540
class.

86
00:05:33,760 --> 00:05:36,580
So I can just say two three.

87
00:05:37,240 --> 00:05:40,980
And as you can see here it says is written superdad to strange here.

88
00:05:41,020 --> 00:05:41,420
OK.

89
00:05:41,440 --> 00:05:46,680
So let's actually delete this line of code here and here it's actually type router.

90
00:05:47,230 --> 00:05:53,380
OK strange that format an insert of the Prentice's of this format.

91
00:05:53,390 --> 00:05:57,940
And when I tried putting a piece of code here and then I'm going to explain to you what's going on here.

92
00:05:57,980 --> 00:06:01,820
So the double quotes as you can see the percept is OK.

93
00:06:02,020 --> 00:06:06,360
So this person is actually refers to this argument Super 8 that was three.

94
00:06:06,520 --> 00:06:10,310
So as you know super refers to the name of the superclass animal.

95
00:06:10,450 --> 00:06:15,040
And this truthtelling Meffert actually refers to this implementation that is actually the inside of

96
00:06:15,040 --> 00:06:19,020
this two string Meffert that is inside of this superclass animal.

97
00:06:19,060 --> 00:06:19,540
OK.

98
00:06:19,660 --> 00:06:23,200
So it's going to execute these lines of code here in that format.

99
00:06:23,290 --> 00:06:23,700
OK.

100
00:06:23,770 --> 00:06:29,720
And then it's going to return the value of the animal name animal color animal power at animal speed.

101
00:06:29,920 --> 00:06:30,310
OK.

102
00:06:30,310 --> 00:06:35,200
Inside of the lion close as you can see here that's actually putting a semicolon here at the end of

103
00:06:35,230 --> 00:06:36,580
our statement.

104
00:06:36,640 --> 00:06:38,630
So that now the arrow is gone.

105
00:06:38,620 --> 00:06:45,460
And here we have a new line character percent and and I have a person and another person is here as

106
00:06:45,460 --> 00:06:46,140
you can see.

107
00:06:46,270 --> 00:06:50,440
So this position here is for this chan are like a fight.

108
00:06:50,540 --> 00:06:51,720
OK this is strange.

109
00:06:51,800 --> 00:06:56,010
Colin and I have asked this person to be here.

110
00:06:56,020 --> 00:07:00,460
So this person's appeal is for this catfight valuable.

111
00:07:00,580 --> 00:07:01,000
OK.

112
00:07:01,030 --> 00:07:05,180
So as you can see here this is not the best way to write our coats here.

113
00:07:05,210 --> 00:07:13,570
I should actually be fair to the name of the Get can fight method here in order to return the value

114
00:07:13,570 --> 00:07:14,940
of these are.

115
00:07:14,950 --> 00:07:15,600
Chan fight.

116
00:07:15,600 --> 00:07:16,150
Ready.

117
00:07:16,180 --> 00:07:16,730
OK.

118
00:07:16,990 --> 00:07:18,820
So this person is what this gets.

119
00:07:18,890 --> 00:07:26,590
Can't fight left here and another nearby character person in and behalf of another person is here.

120
00:07:26,620 --> 00:07:31,550
So he's talking in his 40s value the fighting power of our lion ears.

121
00:07:31,790 --> 00:07:32,150
OK.

122
00:07:32,150 --> 00:07:33,020
Person.

123
00:07:33,160 --> 00:07:37,270
So this person is for this instance variable fighting power.

124
00:07:37,360 --> 00:07:41,930
So here again this is not the best way in order to write Ancoats here.

125
00:07:41,980 --> 00:07:45,470
I should just refer to the name of the kids fighting power.

126
00:07:45,570 --> 00:07:46,160
OK.

127
00:07:46,540 --> 00:07:53,110
Kids fighting power and here is going to return the value of these fighting power instance variable

128
00:07:53,110 --> 00:07:53,670
OK.

129
00:07:54,160 --> 00:07:59,170
So now let's actually go back and say this main activity that Javal fight here and here inside that

130
00:07:59,200 --> 00:08:03,190
this uncreate Somerford that's actually putting some more lines of code here.

131
00:08:03,190 --> 00:08:09,940
So now inside of this uncreate Meffert Let's actually create some objects from the Take take a class.

132
00:08:09,940 --> 00:08:15,060
So as you can see here I actually created Freep objects from these text class.

133
00:08:15,070 --> 00:08:15,550
OK.

134
00:08:15,730 --> 00:08:18,150
The first object is to the animal.

135
00:08:18,370 --> 00:08:25,030
And here you referred to the name of this idea or that idea that the animal and the second object is

136
00:08:25,630 --> 00:08:26,450
the lion.

137
00:08:26,470 --> 00:08:33,300
And here I referred to the name of this ID or that idea that takes the lion and does the first argument

138
00:08:33,640 --> 00:08:37,420
as you can see the first object is the polymorphism.

139
00:08:37,450 --> 00:08:41,880
And here I referred to the name of this ITTL the polymorphism here.

140
00:08:41,950 --> 00:08:44,620
OK let's actually put some more lines of code here.

141
00:08:44,620 --> 00:08:53,980
So here I want to actually create two objects one object from this animal class and another object from

142
00:08:53,980 --> 00:08:54,970
the lion class.

143
00:08:54,970 --> 00:08:55,540
OK.

144
00:08:55,750 --> 00:09:01,730
So as you can see here these are my two objects anemone and the name of this object is animal.

145
00:09:01,780 --> 00:09:05,820
And here I am actually instantiating this object here.

146
00:09:06,100 --> 00:09:11,500
And as you can see I am passing some values to the constructor of this animal class the name of this

147
00:09:11,560 --> 00:09:15,590
animal is where the color of this animal is black.

148
00:09:15,940 --> 00:09:20,860
And here as you can see I assigned an invalid number to these animal power.

149
00:09:20,980 --> 00:09:26,930
And again I actually assigned an invalid numbers to this animal species.

150
00:09:27,040 --> 00:09:27,630
OK.

151
00:09:27,880 --> 00:09:34,560
And then here I actually created an object from the lion class and the name of this object is a lion.

152
00:09:34,600 --> 00:09:40,450
And then I actually assigned somebody used to the constructor of this lion class as you can see here.

153
00:09:40,480 --> 00:09:45,180
And the name of this lion is my lion the color of this lion is yellow.

154
00:09:45,340 --> 00:09:51,530
And here as you can see for the animal power I have actually assigned an invalid number and he had for

155
00:09:51,530 --> 00:09:54,950
the animal split again I assigned an invalid number.

156
00:09:54,960 --> 00:10:03,120
Number negative one and he had this value as you can see inside of this lion class this value here it

157
00:10:03,120 --> 00:10:05,030
can fight boolean variable.

158
00:10:05,190 --> 00:10:10,200
So here inside of this our main activity that I will find here you can see that I assigned a value of

159
00:10:10,200 --> 00:10:17,280
true for the can fight instance variable of this object and this number here one hundred and seventy

160
00:10:17,670 --> 00:10:20,100
is for these fighting power here.

161
00:10:20,190 --> 00:10:20,560
OK.

162
00:10:20,580 --> 00:10:24,280
So inside of this main activity that over here I created these two objects.

