1
00:00:00,950 --> 00:00:02,450
This is the name of our package.

2
00:00:02,450 --> 00:00:04,280
I need to actually create another class.

3
00:00:04,280 --> 00:00:10,900
So just click on this package here and then click on find new and then click on Java class.

4
00:00:11,200 --> 00:00:16,830
So for the name of the class just type in here chat and then click on OK.

5
00:00:16,970 --> 00:00:18,740
As you can see this is our catch class.

6
00:00:18,740 --> 00:00:23,530
So just click on this package here again find new double class.

7
00:00:23,800 --> 00:00:29,110
So for the name of the class just type in here like in OK is our legal class.

8
00:00:29,210 --> 00:00:32,550
Again I want to create another class called Leppert.

9
00:00:32,600 --> 00:00:41,990
So just click on this package here for my new job class and here just typing Lebert OK again I need

10
00:00:41,990 --> 00:00:44,890
to create another class called Baird.

11
00:00:44,900 --> 00:00:50,240
So just click on this package here and then click on find new and then click on job class.

12
00:00:50,240 --> 00:00:52,420
So for the class name just type in here.

13
00:00:52,690 --> 00:00:53,390
OK.

14
00:00:53,630 --> 00:00:55,160
And then click on OK.

15
00:00:55,190 --> 00:00:58,620
So as can see here I created all of these classes.

16
00:00:58,940 --> 00:01:01,220
So now I can actually interact with these classes.

17
00:01:01,220 --> 00:01:02,020
OK.

18
00:01:02,330 --> 00:01:07,940
So now let's actually go inside the Animal class and as you can see here this is our Animal class.

19
00:01:07,940 --> 00:01:14,460
So let's actually double click on this animal that you have here in order to make this a little elevator.

20
00:01:14,690 --> 00:01:17,000
So as you can see here this is our Animal class.

21
00:01:17,210 --> 00:01:24,290
And first let me point out that are all classes in Java up directly or indirectly inherit from the Object

22
00:01:24,290 --> 00:01:24,980
class.

23
00:01:25,180 --> 00:01:25,570
OK.

24
00:01:25,610 --> 00:01:30,550
So as you can see here this Animal class actually inherits from the Object class.

25
00:01:30,560 --> 00:01:38,900
So if I actually put this extents object here so as you can see here this object class is actually inside

26
00:01:38,990 --> 00:01:41,250
the inside the Java that like package.

27
00:01:41,240 --> 00:01:47,990
Ok here I am actually showing you that this animal class is actually inheriting all of the features

28
00:01:48,110 --> 00:01:51,870
and behaviors that are inside this object class.

29
00:01:51,890 --> 00:01:52,390
OK.

30
00:01:52,640 --> 00:01:59,750
But if we actually don't put these two votes here that means that this animal class is actually inheriting

31
00:01:59,750 --> 00:02:00,940
from the Object class.

32
00:02:01,040 --> 00:02:09,290
OK you don't have to actually put this extends object here because that's UB by default or this animal

33
00:02:09,290 --> 00:02:12,520
class is actually inheriting from this object class.

34
00:02:12,530 --> 00:02:12,960
OK.

35
00:02:12,980 --> 00:02:20,380
So let's actually go inside this object class and see the behaviors that are inside this object class.

36
00:02:20,390 --> 00:02:22,590
So if you are using a match 6.

37
00:02:22,670 --> 00:02:26,600
Just hold the command key and then click on object.

38
00:02:26,810 --> 00:02:32,300
And if you are using a Windows machine you just need to hold the control key and then click on object.

39
00:02:32,330 --> 00:02:35,050
So as you can see here this is our object class.

40
00:02:35,060 --> 00:02:35,400
OK.

41
00:02:35,420 --> 00:02:40,100
And here you can see the behaviors and the features that are inside this class.

42
00:02:40,130 --> 00:02:46,190
Ok for example this Meffert equals or as you can see this is the constructor OK constructs a new instance

43
00:02:46,490 --> 00:02:47,570
of Object.

44
00:02:47,570 --> 00:02:48,320
OK.

45
00:02:48,630 --> 00:02:51,480
And other methods that you can see here finalize.

46
00:02:51,610 --> 00:02:52,890
OK.

47
00:02:52,930 --> 00:02:55,260
So notify.

48
00:02:55,340 --> 00:02:56,790
OK this is another method.

49
00:02:56,810 --> 00:02:59,400
So let's actually close this class here.

50
00:03:00,020 --> 00:03:02,780
And inside this animal class.

51
00:03:02,780 --> 00:03:07,730
Now we want to actually put my implementation's my own coats inside this class.

52
00:03:07,730 --> 00:03:10,550
Most of the program is actually taught or put.

53
00:03:11,030 --> 00:03:17,090
These two votes here extends object because by default our class is actually inheriting from the object

54
00:03:17,090 --> 00:03:17,640
class.

55
00:03:17,720 --> 00:03:20,040
So we don't need to put these words here.

56
00:03:20,210 --> 00:03:23,550
So not inside the curly braces I can put my own codes.

57
00:03:23,720 --> 00:03:29,240
So now I want to create some instance variables inside these animal class.

58
00:03:29,360 --> 00:03:37,230
So just type in here private as you can see the access modifier of my instance variable is private.

59
00:03:37,640 --> 00:03:42,090
And here I want to specify that my variable is going to be a constant.

60
00:03:42,110 --> 00:03:48,110
OK because I don't want to actually allow any other classes or methods to actually change the value

61
00:03:48,110 --> 00:03:50,650
of this instance variable.

62
00:03:50,810 --> 00:03:53,090
So I just need to put in the final keyword here.

63
00:03:53,330 --> 00:03:57,790
And then I need to specify the data type of this variable as strange.

64
00:03:58,160 --> 00:04:02,620
And then I need to give a name to this instance variable name.

65
00:04:02,720 --> 00:04:08,130
So as you can see here I didn't assign any value to this instance variable because I don't because I

66
00:04:08,180 --> 00:04:13,310
want to actually show you an important point about constructors in this tutorial.

67
00:04:13,430 --> 00:04:16,460
So as you can see it's now shown as an error.

68
00:04:16,460 --> 00:04:22,340
So let's actually Hulver our mouse pointer over the error area and see what's the added variable name

69
00:04:22,520 --> 00:04:24,440
might not have been initialized.

70
00:04:24,440 --> 00:04:29,390
So as you can see here it's complaining that we actually didn't assign any value to this instance variable.

71
00:04:29,420 --> 00:04:29,780
OK.

72
00:04:29,810 --> 00:04:33,620
So let's actually create another in another instance variable private.

73
00:04:33,860 --> 00:04:40,370
And again my variable is going to be a constant find all the data type of my variable is strange and

74
00:04:40,640 --> 00:04:42,500
the name of my variable is color.

75
00:04:42,800 --> 00:04:43,350
OK.

76
00:04:43,490 --> 00:04:46,790
And then I want to create another instance variable private.

77
00:04:46,790 --> 00:04:50,230
Now I want to create another instance variable.

78
00:04:50,360 --> 00:04:53,110
So the access modifier of my variable is private.

79
00:04:53,150 --> 00:04:56,980
And here my value is not and constant.

80
00:04:57,140 --> 00:05:03,280
So the data type of my variable is in it and the name of my variable is amount of speed.

81
00:05:03,410 --> 00:05:04,730
And then I need to.

82
00:05:04,910 --> 00:05:08,540
And then I need to put in a semi-colon at the end of my statement.

83
00:05:08,540 --> 00:05:14,990
And again I want to create another instance variable private int I'm out of power.

84
00:05:15,680 --> 00:05:16,280
OK.

85
00:05:17,920 --> 00:05:23,190
So as you can see here these are the instance variables that I created inside these animal class.

86
00:05:23,200 --> 00:05:24,040
OK.

87
00:05:24,400 --> 00:05:29,960
And as you can see here because we didn't assign a value to these are constants here.

88
00:05:30,040 --> 00:05:32,190
The Android studio is actually complaining.

89
00:05:32,290 --> 00:05:37,690
So now I want to actually create a constructor for this animal class.

90
00:05:37,690 --> 00:05:38,180
OK.

91
00:05:38,380 --> 00:05:44,000
So first I need to specify the access modifier of my constructor public.

92
00:05:45,060 --> 00:05:45,840
OK.

93
00:05:46,210 --> 00:05:50,850
And the name of my constructor must be the same as the name of my class.

94
00:05:50,980 --> 00:05:51,750
OK.

95
00:05:52,020 --> 00:05:53,090
And.

96
00:05:54,160 --> 00:05:58,760
And then I need to put in a pair of round brackets after my constructor name.

97
00:05:58,870 --> 00:06:03,640
And then I need to open and close my constructor by using D-school curly braces.

98
00:06:03,640 --> 00:06:04,310
OK.

99
00:06:04,630 --> 00:06:09,580
So inside their practices here you want to specify that this constructor is going to actually accept

100
00:06:09,880 --> 00:06:10,940
some arguments.

101
00:06:10,960 --> 00:06:18,400
Ok so my first argument is of type as strange and the name of my argument is name.

102
00:06:18,760 --> 00:06:19,500
OK.

103
00:06:19,930 --> 00:06:27,610
My second argument is of type as three and again and the name of my argument is color.

104
00:06:27,640 --> 00:06:35,250
My favorite argument is of type int and the name of my argument is amount of speed.

105
00:06:35,610 --> 00:06:36,170
OK.

106
00:06:36,370 --> 00:06:44,250
And again the later type of my argument is int and the name of my argument is amount of power.

107
00:06:45,440 --> 00:06:46,200
OK.

108
00:06:46,630 --> 00:06:52,270
So as you can see here these are the arguments that I specified for this constructor here.

109
00:06:52,290 --> 00:06:58,250
OK so now I want to actually initialize these instance variables.

110
00:06:58,380 --> 00:06:58,950
OK.

111
00:06:59,110 --> 00:07:05,050
So in order to actually refer to these instance variables inside this constructor are you need to putting

112
00:07:05,110 --> 00:07:06,640
this key vote here.

113
00:07:06,880 --> 00:07:07,340
OK.

114
00:07:07,360 --> 00:07:15,970
Because the name of this instance variable is actually the same as this as the name of this argument

115
00:07:15,970 --> 00:07:16,550
here.

116
00:07:16,600 --> 00:07:23,980
I need to put the key word this here in order to refer to this instance valuable insight this constructor.

117
00:07:24,000 --> 00:07:32,360
OK so does that name assignments operator name ok.

118
00:07:32,970 --> 00:07:40,210
Does that color assignment operator color.

119
00:07:41,350 --> 00:07:48,870
OK so this color here actually refers to this instance variable and this color refers to this argument

120
00:07:48,910 --> 00:07:49,180
here.

121
00:07:49,180 --> 00:07:57,000
OK so because the name of this argument here is the same as this is the same as this instance variable

122
00:07:57,000 --> 00:07:57,790
here.

123
00:07:58,000 --> 00:08:05,710
I needed to actually put this key word here in order to refer to this instance variable.

124
00:08:05,710 --> 00:08:10,110
Ok so this key vote here actually refers to this class.

125
00:08:10,270 --> 00:08:11,160
OK.

126
00:08:11,530 --> 00:08:14,930
So this thought color assignment operator color.

127
00:08:15,070 --> 00:08:15,980
OK.

128
00:08:16,540 --> 00:08:22,260
And again does that amount of speed.

129
00:08:22,410 --> 00:08:24,890
Assignment operator I'm amount of speed.

130
00:08:24,910 --> 00:08:29,170
Does that amount of power.

131
00:08:29,500 --> 00:08:31,080
Assignment operator.

132
00:08:31,360 --> 00:08:33,630
Amount of power.

133
00:08:34,030 --> 00:08:37,010
And then I need to put in a semicolon at the end of my statement.

134
00:08:37,010 --> 00:08:37,900
OK.

135
00:08:38,380 --> 00:08:41,510
So as you can see here now the arrows are gone.

136
00:08:41,700 --> 00:08:42,570
OK.

137
00:08:42,850 --> 00:08:49,790
So here I initialized these instance variables and now the error is gone.

138
00:08:50,040 --> 00:08:50,430
OK.

139
00:08:50,440 --> 00:08:57,970
So whenever that I want to actually create an object from this animal class to this constructor it's

140
00:08:57,970 --> 00:08:58,860
going to be called.

141
00:08:58,930 --> 00:08:59,400
OK.

142
00:08:59,470 --> 00:09:04,390
And then I need to specify a value for these instance variables.

143
00:09:04,570 --> 00:09:12,370
OK if I don't actually specify any value for this instance variables I cannot create any object from

144
00:09:12,370 --> 00:09:13,410
this animal class.

145
00:09:13,440 --> 00:09:13,930
OK.

146
00:09:13,990 --> 00:09:20,740
Because it is because this constructor is going to actually accept some values and that values is going

147
00:09:20,740 --> 00:09:23,290
to be assigned to these instance variables.

148
00:09:23,290 --> 00:09:25,910
OK so hopefully that makes sense.

149
00:09:25,930 --> 00:09:32,110
Now I want to actually create the getters and setters for these instance variables because as you can

150
00:09:32,110 --> 00:09:37,280
see the access modifier of these instance variables is private.

151
00:09:37,390 --> 00:09:46,150
OK so I need to actually create some are Hera's or setters in order to allow other classes to actually

152
00:09:46,150 --> 00:09:48,760
set or get the values of these instance variables.

153
00:09:48,760 --> 00:09:49,160
OK.

