1
00:00:00,900 --> 00:00:06,690
And let's actually go inside this main activity that you have a fight here and now let's actually create

2
00:00:06,780 --> 00:00:15,660
an object from this vehicle class and the name of this vehicle can be my vehicle and then I put in an

3
00:00:15,660 --> 00:00:19,880
assignment operator new vehicle.

4
00:00:20,460 --> 00:00:21,120
OK.

5
00:00:21,240 --> 00:00:24,900
So here we need to actually passing some values.

6
00:00:24,900 --> 00:00:30,960
First of all I need to actually passing the value of the speed so valuable the value of the speed of

7
00:00:30,960 --> 00:00:32,200
this my vehicle object.

8
00:00:32,200 --> 00:00:37,060
For example 45 karma has braking system.

9
00:00:37,060 --> 00:00:43,370
True karma and number of wheels for example.

10
00:00:43,410 --> 00:00:44,040
Fourth.

11
00:00:44,270 --> 00:00:44,860
OK.

12
00:00:45,090 --> 00:00:48,560
And then I put in a semi-colon at the end of my statement.

13
00:00:48,570 --> 00:00:52,200
Now I want to actually output these values to the screen.

14
00:00:52,470 --> 00:00:59,400
So first of all we need to actually create Smurfette in order to allow us to put these values to the

15
00:00:59,400 --> 00:01:00,010
screen.

16
00:01:00,240 --> 00:01:06,030
So let's actually overwrite the twisting method that you actually to inherit from the Object class.

17
00:01:06,030 --> 00:01:06,720
OK.

18
00:01:07,200 --> 00:01:12,840
So I just need to refer to the name of this twittering Merfeld and here as you can see it says return's

19
00:01:12,840 --> 00:01:14,210
superb that was 3M.

20
00:01:14,430 --> 00:01:20,070
So I don't want to actually execute the implementations that are inside the twisting Meffert inside

21
00:01:20,070 --> 00:01:20,850
the Object class.

22
00:01:20,860 --> 00:01:21,730
OK.

23
00:01:21,960 --> 00:01:24,170
This super refers to the object class.

24
00:01:24,210 --> 00:01:30,690
So I don't want to actually execute those implementations that are inside these two or three Meffert

25
00:01:30,750 --> 00:01:32,870
inside the inside the object class.

26
00:01:32,880 --> 00:01:33,600
OK.

27
00:01:34,020 --> 00:01:36,460
So let's actually delete this line of code here.

28
00:01:36,750 --> 00:01:40,580
So here inside the Smurfette I can just type in return.

29
00:01:40,680 --> 00:01:50,670
Strange that format and first of all I need to actually specify the formatting instructions of this

30
00:01:50,820 --> 00:01:51,510
object.

31
00:01:51,630 --> 00:01:52,400
OK.

32
00:01:52,760 --> 00:01:53,490
Percent.

33
00:01:53,680 --> 00:01:55,580
As comma.

34
00:01:56,020 --> 00:02:00,360
And now I need to actually specify the speed of instance variable.

35
00:02:00,730 --> 00:02:02,320
So percent the.

36
00:02:02,670 --> 00:02:05,380
And again percent as comma.

37
00:02:05,730 --> 00:02:09,790
Now I want to actually specify the has braking system in sense valuable.

38
00:02:10,080 --> 00:02:16,410
So percent B and again percent as comma.

39
00:02:16,900 --> 00:02:22,080
And now we want to actually specify the number of Veals instance variable.

40
00:02:22,400 --> 00:02:25,540
So percent D.

41
00:02:26,120 --> 00:02:31,850
And again we have another instance variable right speed which is of type integer.

42
00:02:32,180 --> 00:02:36,800
So here I can just type in percent as comma percent D.

43
00:02:37,210 --> 00:02:37,780
OK.

44
00:02:37,880 --> 00:02:42,910
So now I want to actually refer to these instance variables.

45
00:02:42,950 --> 00:02:50,270
So remember that I said in this earlier in this tutorial always use getters and setters in order to

46
00:02:50,270 --> 00:02:56,860
mislead manipulate the value of your instance variables even if you are using them in your own class.

47
00:02:57,080 --> 00:03:03,330
OK so now I can actually access these instance variables by using these get here as Meffert.

48
00:03:03,350 --> 00:03:03,810
OK.

49
00:03:03,890 --> 00:03:10,330
So here I can actually put in some arguments in order to relate those arguments to these talking.

50
00:03:10,400 --> 00:03:10,990
OK.

51
00:03:11,180 --> 00:03:14,370
So for the first token I need to actually put in a string value.

52
00:03:14,570 --> 00:03:22,900
So I just put it into double quotes here and again just typing speed ok karma.

53
00:03:23,540 --> 00:03:29,690
And now I need to actually put up an argument of type integer so I can just refer to the name of this

54
00:03:29,690 --> 00:03:32,670
good speed method.

55
00:03:32,720 --> 00:03:39,480
And again I need to actually put in a string value here has braking system so I can just type in up

56
00:03:39,620 --> 00:03:47,070
can break and come up and here I need to actually putting in an argument of type Boolean.

57
00:03:47,300 --> 00:03:48,840
So I can just put in.

58
00:03:48,890 --> 00:03:54,630
So I can't just refer to the name of that gets has breaking system comma.

59
00:03:54,950 --> 00:04:03,370
Let's actually create a new line here and now I need to actually again putting a value of type string.

60
00:04:03,630 --> 00:04:13,700
Ok so I just put it into double quotes and then inside the double quotes I can't just put in a value

61
00:04:13,700 --> 00:04:14,470
of type string.

62
00:04:14,510 --> 00:04:20,440
Ok so a number of violists number of wheels.

63
00:04:21,080 --> 00:04:22,880
OK come on.

64
00:04:23,190 --> 00:04:30,440
And now I can actually refer to the name of this get number of veal Smurfit OK good number of years

65
00:04:30,980 --> 00:04:31,750
comma.

66
00:04:31,910 --> 00:04:35,450
And again we have these percent as talking here.

67
00:04:35,750 --> 00:04:42,170
So I can't just put into double quotes and then in a set of double quotes I can just refer a value of

68
00:04:42,170 --> 00:04:42,870
type string.

69
00:04:42,920 --> 00:04:46,260
So for this right speed instance variable.

70
00:04:46,400 --> 00:04:49,890
So I can just type in right speed.

71
00:04:50,280 --> 00:04:55,140
Ok comma gets right speed.

72
00:04:55,760 --> 00:04:59,150
And then I put in a semi-colon at the end of this method.

73
00:04:59,180 --> 00:04:59,730
OK.

74
00:05:00,570 --> 00:05:02,800
So hopefully that makes sense.

75
00:05:02,850 --> 00:05:06,220
And let's actually go back inside this main activity that you are here.

76
00:05:06,480 --> 00:05:12,710
First we need to actually create some objects from the text your class so I can just type in here text

77
00:05:12,740 --> 00:05:16,780
you the name of this text is TXI the vehicle.

78
00:05:16,950 --> 00:05:17,590
OK.

79
00:05:17,820 --> 00:05:24,720
And then I put an assignment operator here and then I need to actually cast this object to a text you

80
00:05:25,200 --> 00:05:32,820
find view by ID or that Id dot the X the vehicle.

81
00:05:32,840 --> 00:05:33,750
OK.

82
00:05:33,930 --> 00:05:36,800
And then I need to put in a semi-colon at the end of my statement.

83
00:05:36,990 --> 00:05:43,620
So now I can actually refer to the name of the vehicle object that said text.

84
00:05:43,620 --> 00:05:50,200
And that inside Apprentice's I can just refer to the name of this mine my vehicle object that has three.

85
00:05:50,600 --> 00:05:51,430
OK.

86
00:05:51,780 --> 00:05:53,910
So hopefully that makes sense.

87
00:05:53,940 --> 00:05:57,570
And now let's actually run our project and see what happens.

88
00:05:57,570 --> 00:06:03,300
So as you can see here these are the values that are actually outputted to the screen or shape.

89
00:06:03,420 --> 00:06:08,660
So speed 45 as you can see here and can break through.

90
00:06:08,900 --> 00:06:09,880
OK.

91
00:06:09,900 --> 00:06:13,410
Number Aviles four and right speed zero.

92
00:06:13,440 --> 00:06:21,450
And now you may wonder why the value of this right speed variable is zero because we actually created

93
00:06:22,050 --> 00:06:25,630
an instant Smurfette inside this vehicle class here.

94
00:06:25,680 --> 00:06:26,550
OK.

95
00:06:26,970 --> 00:06:27,630
Right.

96
00:06:28,020 --> 00:06:31,440
But we didn't actually call the Smurfette on our object.

97
00:06:31,440 --> 00:06:31,900
OK.

98
00:06:31,920 --> 00:06:33,460
On our vehicle object.

99
00:06:33,480 --> 00:06:40,290
So before we actually want to output these values to the screen before this line of code as you can

100
00:06:40,290 --> 00:06:44,160
see here we can actually call that Smurfette on this vehicle object.

101
00:06:44,160 --> 00:06:46,830
So first I need to actually first with the name of this object.

102
00:06:46,830 --> 00:06:48,310
That's right.

103
00:06:48,870 --> 00:06:49,630
OK.

104
00:06:50,010 --> 00:06:56,960
And now it's going to actually assign some value to the right speed instance variable.

105
00:06:56,970 --> 00:06:57,470
OK.

106
00:06:57,570 --> 00:07:00,840
So let's actually run our project and see what happens.

107
00:07:00,840 --> 00:07:06,750
So as you can see here now the value of this road speed variable is one hundred and eighty.

108
00:07:06,750 --> 00:07:07,160
OK.

109
00:07:07,230 --> 00:07:09,150
So hopefully that makes sense.

110
00:07:09,150 --> 00:07:12,890
Now let's actually go ahead and work on this car class.

111
00:07:12,900 --> 00:07:13,520
OK.

112
00:07:13,590 --> 00:07:21,780
So now for example suppose that we don't have any specific characteristics that are going to be related

113
00:07:21,840 --> 00:07:22,890
only to this car class.

114
00:07:22,890 --> 00:07:23,300
OK.

115
00:07:23,370 --> 00:07:29,090
So in this case we can actually create only a constructor for this car class.

116
00:07:29,100 --> 00:07:34,780
So first I need to actually specify the access modifier of this constructor and then I need to actually

117
00:07:34,780 --> 00:07:37,190
refer to the name of this class car.

118
00:07:37,680 --> 00:07:44,280
And now as you can see inside the prentices we can actually specify some arguments.

119
00:07:44,490 --> 00:07:51,390
So now let's actually specify that this car class actually can inherit all of the features and behaviors

120
00:07:51,690 --> 00:07:53,530
that are inside this vehicle class.

121
00:07:53,550 --> 00:07:54,510
OK.

122
00:07:54,510 --> 00:07:57,880
So here I can just type in extends vehicle.

123
00:07:57,990 --> 00:07:58,740
OK.

124
00:07:59,160 --> 00:08:04,220
So now as you can see here in this our construct that is now showing us an error.

125
00:08:04,530 --> 00:08:05,040
OK.

126
00:08:05,190 --> 00:08:11,280
So we need to actually initialize the constructor that is inside the superclass which is this vehicle

127
00:08:11,290 --> 00:08:11,770
OK.

128
00:08:11,880 --> 00:08:17,130
So let's actually go inside this vehicle class and as you can see here we've got this constructor here

129
00:08:17,640 --> 00:08:23,280
and we need to actually initialize this kind of structure inside this car class.

130
00:08:23,280 --> 00:08:23,880
OK.

131
00:08:24,240 --> 00:08:29,880
So we need to actually passing a value for the speed of value for the HAs braking system and for an

132
00:08:29,910 --> 00:08:34,220
a value for a number of wheels of that specific vehicle or car.

133
00:08:34,280 --> 00:08:35,230
OK.

134
00:08:35,550 --> 00:08:42,030
So inside this car class I can actually specify those arguments in it and the name of this argument

135
00:08:42,030 --> 00:08:43,420
is speed.

136
00:08:43,740 --> 00:08:48,540
Karma Boullion has braking system.

137
00:08:48,630 --> 00:08:50,170
Ok on.

138
00:08:50,410 --> 00:08:55,110
End number of wheels.

139
00:08:55,650 --> 00:08:56,470
OK.

140
00:08:56,760 --> 00:09:02,480
So now I can actually initialize the constructor of the superclass by just passing these values.

141
00:09:02,490 --> 00:09:06,170
Speed camera has braking system.

142
00:09:06,270 --> 00:09:06,980
Come on.

143
00:09:07,170 --> 00:09:08,420
Number of wheels.

144
00:09:08,430 --> 00:09:09,010
OK.

145
00:09:09,210 --> 00:09:13,880
And as you can see here we don't have any instance variable related to this car class.

146
00:09:13,890 --> 00:09:14,400
OK.

147
00:09:14,490 --> 00:09:20,280
I can actually overwrite the two string method that we are actually inheriting from this vehicle class

148
00:09:20,730 --> 00:09:22,930
so I can just take in here too strange.

149
00:09:23,370 --> 00:09:29,310
And then it can actually execute the implementations that are inside these two string Mefford inside

150
00:09:29,310 --> 00:09:30,610
this vehicle class.

151
00:09:30,630 --> 00:09:31,250
OK.

152
00:09:31,530 --> 00:09:36,280
So super refers to this vehicle class that was three in the first with this method.

153
00:09:36,510 --> 00:09:42,120
And then it can actually go inside the Smurfette and then it's gonna execute this line of code here.

154
00:09:42,120 --> 00:09:42,600
OK.

155
00:09:42,750 --> 00:09:47,910
So hopefully that makes sense and then it's actually going inside this main activity that over here

156
00:09:48,180 --> 00:09:53,180
and now I can actually create an object from this car class.

157
00:09:53,460 --> 00:09:54,290
OK.

158
00:09:54,780 --> 00:10:04,970
And the name of my car object is my car and the puts an assignment operator here new caught.

159
00:10:05,340 --> 00:10:05,940
OK.

