1
00:00:00,450 --> 00:00:02,370
Again I referred to the name of the text.

2
00:00:02,370 --> 00:00:06,500
Your class takes the bird.

3
00:00:07,080 --> 00:00:15,560
And then I put an assignment operator here and then I cast this object to a text you object find view

4
00:00:15,570 --> 00:00:24,780
by ID card that Id dot X the bird and then I put a semi-colon at the end of my statement.

5
00:00:24,780 --> 00:00:29,130
OK so now I can interact with these components in the screen here.

6
00:00:29,130 --> 00:00:29,640
OK.

7
00:00:29,880 --> 00:00:40,750
I just need to refer to the name of that the animal object the animal that said text animal on that.

8
00:00:40,860 --> 00:00:46,150
And then I referred to the name of the string Meffert that I override it inside the Animal class.

9
00:00:46,180 --> 00:00:50,140
OK so now let's actually run our project and see what happens.

10
00:00:50,280 --> 00:00:50,940
OK.

11
00:00:51,000 --> 00:00:54,500
As you can see here this is the value that is outputted here.

12
00:00:54,510 --> 00:00:57,680
OK name Tiger Carlier aren't.

13
00:00:57,960 --> 00:01:01,300
And these are the two values for the speed and power.

14
00:01:01,440 --> 00:01:04,790
So as you can see here we cannot understand.

15
00:01:04,890 --> 00:01:06,950
What are these values relate to.

16
00:01:06,960 --> 00:01:07,640
OK.

17
00:01:07,770 --> 00:01:14,970
So let's actually go back inside the animate Animal class and as you can see here here I can actually

18
00:01:14,970 --> 00:01:21,810
put others tokens in order to specify what are these amount of speed instance valuable and this amount

19
00:01:21,810 --> 00:01:24,200
of power instance variable relate to.

20
00:01:24,320 --> 00:01:25,300
OK.

21
00:01:25,320 --> 00:01:29,720
So let's actually put another percent here.

22
00:01:32,430 --> 00:01:37,040
Person as colon and let's actually put another percent here.

23
00:01:37,110 --> 00:01:38,010
OK.

24
00:01:38,670 --> 00:01:45,030
So now we need to actually put other arguments here in order to actually relate those arguments to these

25
00:01:46,260 --> 00:01:47,070
tokens here.

26
00:01:47,070 --> 00:01:47,770
OK.

27
00:01:47,970 --> 00:01:54,370
So after this color instance variable i just need to put in two double coats and that inside double

28
00:01:54,370 --> 00:01:54,790
quotes.

29
00:01:54,800 --> 00:01:56,980
I can just type in speed.

30
00:01:57,080 --> 00:01:57,490
OK.

31
00:01:57,510 --> 00:02:04,110
And then I put in a comma here and after this amount of spit instance variable i just need to put into

32
00:02:04,140 --> 00:02:06,830
double quotes and then inserted double quotes.

33
00:02:06,840 --> 00:02:09,030
I just need to type in power.

34
00:02:09,030 --> 00:02:15,660
So as you can see here now this string literal here is related to these are actually at auction here.

35
00:02:15,660 --> 00:02:15,910
OK.

36
00:02:15,900 --> 00:02:16,370
Percent.

37
00:02:16,390 --> 00:02:16,800
Yes.

38
00:02:16,860 --> 00:02:17,530
OK.

39
00:02:17,730 --> 00:02:21,470
We specified that we are going to have an argument of type.

40
00:02:21,540 --> 00:02:22,210
Strange.

41
00:02:22,290 --> 00:02:22,880
OK.

42
00:02:23,310 --> 00:02:27,680
And these are is here is actually related to this string lead role here.

43
00:02:27,690 --> 00:02:28,340
OK.

44
00:02:28,380 --> 00:02:30,000
So let's actually put a comma here.

45
00:02:30,090 --> 00:02:32,270
As you can see there is an error here.

46
00:02:32,310 --> 00:02:38,930
We need to actually put a comma here in order to actually separate these arguments here.

47
00:02:39,060 --> 00:02:43,080
And if I don't my project again let's see what happens.

48
00:02:43,110 --> 00:02:48,130
Now it's going to take quite some time in order to actually run our project as you can see.

49
00:02:48,160 --> 00:02:55,060
This is the value that is out with that Hiroki named Tiger color aren't speed 60 power 60.

50
00:02:55,080 --> 00:02:55,480
OK.

51
00:02:55,500 --> 00:02:59,090
So as you can see here with just two line of codes we did manage.

52
00:02:59,280 --> 00:03:02,910
We did manage to output these values to the screen here.

53
00:03:02,910 --> 00:03:03,400
OK.

54
00:03:03,450 --> 00:03:07,610
So that's the power of inheritance inside the animal class.

55
00:03:07,890 --> 00:03:11,120
Let's actually double click on this tab here.

56
00:03:11,610 --> 00:03:19,120
I actually override this method in order to actually output a string value to the screen.

57
00:03:19,230 --> 00:03:19,750
OK.

58
00:03:19,920 --> 00:03:26,640
And here in say the main activity class here as you can see I created an object from the friendly animal

59
00:03:26,640 --> 00:03:34,610
class and with only one line of code I did manage to actually output this value to the screen here.

60
00:03:34,610 --> 00:03:34,930
OK.

61
00:03:34,950 --> 00:03:37,730
Next the animal that takes animal won.

62
00:03:37,800 --> 00:03:38,580
That was three.

63
00:03:38,610 --> 00:03:39,500
OK.

64
00:03:39,960 --> 00:03:41,550
So hopefully that makes sense.

65
00:03:41,700 --> 00:03:46,940
So now let's actually go on and work on these cat class here.

66
00:03:46,950 --> 00:03:47,600
OK.

67
00:03:47,850 --> 00:03:48,400
OK.

68
00:03:48,540 --> 00:03:52,870
Now inside the cat class I want to actually create some instance variables.

69
00:03:52,890 --> 00:03:53,790
OK.

70
00:03:54,150 --> 00:03:59,270
So remember that only specific types of animals are inside the cat family.

71
00:03:59,290 --> 00:04:03,870
Like actually Tigers lion leopard and other animals.

72
00:04:03,870 --> 00:04:04,510
OK.

73
00:04:04,860 --> 00:04:09,640
So first I want to actually create some instance variables private.

74
00:04:10,440 --> 00:04:12,220
OK fine.

75
00:04:12,330 --> 00:04:19,680
So this idea is going to be a constant stream data type of my variable is a string and the name of my

76
00:04:19,680 --> 00:04:21,170
variable is name.

77
00:04:21,400 --> 00:04:29,060
Ok private fine on a strange color.

78
00:04:32,230 --> 00:04:36,940
Private's ain't amount of speed.

79
00:04:39,380 --> 00:04:40,940
Ok private

80
00:04:44,520 --> 00:04:47,070
ain't amount of power

81
00:04:51,380 --> 00:04:52,650
OK.

82
00:04:52,910 --> 00:05:00,170
So as you can see here I am actually duplicating some codes that are inside to inside the Animal class

83
00:05:00,170 --> 00:05:03,170
here into this chat class here.

84
00:05:03,170 --> 00:05:03,790
OK.

85
00:05:03,990 --> 00:05:10,880
So and there is a reason for that and I want to actually show you if we don't actually use the inheritance

86
00:05:11,000 --> 00:05:14,710
what are the problems that we may encounter in our projects.

87
00:05:14,720 --> 00:05:15,400
OK.

88
00:05:15,530 --> 00:05:20,730
So here I am actually duplicating some codes that are inside the animal class.

89
00:05:20,850 --> 00:05:29,580
OK so now let's actually create some instance variables for these acads class ok.

90
00:05:29,900 --> 00:05:32,580
Private fine on

91
00:05:35,350 --> 00:05:37,700
NKT number of Lex

92
00:05:41,700 --> 00:05:50,670
ocelli private boolean can hunt other animals.

93
00:05:50,690 --> 00:05:51,200
OK.

94
00:05:51,380 --> 00:05:55,500
And boolean variables can only hold a true value or a false value.

95
00:05:55,500 --> 00:06:00,070
OK so the name of my variable is Chantant other animals.

96
00:06:00,080 --> 00:06:06,040
So now let's actually create a constructor in order to initialize these instance variables here.

97
00:06:06,090 --> 00:06:14,390
OK so first in order to create a constructor I need to actually specify the access modifier of my constructor

98
00:06:14,390 --> 00:06:15,910
first public.

99
00:06:16,100 --> 00:06:22,010
And then I need to give a name to my constructor so the name of my constructor must be the same as the

100
00:06:22,010 --> 00:06:23,290
name of this cat class.

101
00:06:23,300 --> 00:06:23,810
OK.

102
00:06:23,990 --> 00:06:31,250
So public chats and then I put in a Around two decades after my constructor name.

103
00:06:31,400 --> 00:06:36,290
And then I actually opened and closed my constructor by using these curly braces.

104
00:06:36,290 --> 00:06:36,790
OK.

105
00:06:37,010 --> 00:06:42,740
So inside the Prentice's I want to actually specify that my constructor is going to accept arguments.

106
00:06:42,820 --> 00:06:47,680
OK so the first sort the data type of the first argument is a three.

107
00:06:48,320 --> 00:06:59,700
The name of my argument is name comma as strange caller comma int amount of speed.

108
00:07:00,910 --> 00:07:05,600
Comma in and out of power comma.

109
00:07:06,430 --> 00:07:09,490
Ain't number of legs.

110
00:07:09,670 --> 00:07:16,250
Come on Boullion can hunt other animals OK.

111
00:07:16,760 --> 00:07:18,770
Inside the constructor.

112
00:07:18,790 --> 00:07:21,450
Let's actually initialize these instance variables.

113
00:07:21,500 --> 00:07:27,780
So inside the constructor in order to refer to this named instance variable I just type in here this

114
00:07:28,280 --> 00:07:32,860
dot name assignment operator name.

115
00:07:33,210 --> 00:07:33,930
OK.

116
00:07:34,280 --> 00:07:40,910
These dot color assignments operator color.

117
00:07:41,610 --> 00:07:42,250
OK.

118
00:07:42,380 --> 00:07:48,620
So as you can see here this name here refers to this named instance variable and this name here refers

119
00:07:48,890 --> 00:07:50,850
to this name argument here.

120
00:07:50,870 --> 00:07:58,280
Ok to this argument and this color refers to this color instance variable here and this color refers

121
00:07:58,400 --> 00:08:00,140
to this argument here.

122
00:08:00,140 --> 00:08:00,780
OK.

123
00:08:01,100 --> 00:08:03,980
So that's why we actually put this key vote here.

124
00:08:04,030 --> 00:08:07,310
Does that color this refers to this class.

125
00:08:07,400 --> 00:08:22,460
Ok so at this dot amount of speed assignment operator amount of speed does that amount of power assignment

126
00:08:22,490 --> 00:08:24,530
operator amount of power.

127
00:08:24,600 --> 00:08:26,030
OK.

128
00:08:26,050 --> 00:08:31,360
Again these that number of legs.

129
00:08:32,140 --> 00:08:44,350
Assignment operator number of legs these that can hunt other animals assignments operator can hunt other

130
00:08:44,350 --> 00:08:44,820
animals.

131
00:08:44,830 --> 00:08:46,030
OK.

132
00:08:46,510 --> 00:08:51,210
So as you can see here I initialized this instance variables here.

133
00:08:51,550 --> 00:08:52,130
OK.

134
00:08:52,210 --> 00:08:58,200
So now you might actually create some getters and setters for actualities instance variables.

135
00:08:58,240 --> 00:08:58,820
OK.

136
00:08:59,140 --> 00:09:05,350
So now you want to actually show you a trick in order to generate the get here and setters automatically

137
00:09:05,350 --> 00:09:06,220
OK.

138
00:09:06,370 --> 00:09:15,870
So actually our Right-Click outside of this constructor right click here and then go to generate click

139
00:09:15,870 --> 00:09:21,320
and generate and then click on get her and set her on.

140
00:09:21,340 --> 00:09:24,610
As you can see here we've got this instance variables here.

141
00:09:24,610 --> 00:09:31,550
OK this name instance variable color instance variable amount of speed instance variable amount of power

142
00:09:31,560 --> 00:09:38,710
instance variable number of legs instance variable and this can't can hunt other animals instance variable

143
00:09:38,980 --> 00:09:40,020
which is of type float.

144
00:09:40,030 --> 00:09:40,630
OK.

145
00:09:40,960 --> 00:09:47,530
So if I actually select all of these instance variables here by holding on command key on my keyboard

146
00:09:47,830 --> 00:09:51,670
and then clicking on these for instance variables.

147
00:09:51,670 --> 00:09:56,230
If you are using a Windows machine you need to actually hold the control key on your keyboard and then

148
00:09:56,230 --> 00:10:01,470
select all of these instance variables OK and then click on OK.

149
00:10:01,690 --> 00:10:08,560
So as you can see here are the Android studio automatically generated getters and setters for my instance

150
00:10:08,560 --> 00:10:09,110
variables.

151
00:10:09,130 --> 00:10:09,540
OK.

