1
00:00:00,160 --> 00:00:03,790
OK as you can see here these are the components inside the screen.

2
00:00:03,810 --> 00:00:04,610
OK.

3
00:00:05,250 --> 00:00:07,320
So hopefully that makes sense.

4
00:00:07,350 --> 00:00:13,100
Let's actually double click on this content underline that example and just select the spots in here.

5
00:00:13,110 --> 00:00:15,040
So just select is a button here.

6
00:00:15,210 --> 00:00:21,010
And now let's actually find the layout here and we can try to change this value.

7
00:00:21,010 --> 00:00:24,450
This Arap content value to match palette.

8
00:00:24,720 --> 00:00:25,290
OK.

9
00:00:25,440 --> 00:00:31,840
Now as you can see here David of disputant actually covers the entire screen.

10
00:00:31,860 --> 00:00:34,300
OK the entire width of the screen.

11
00:00:34,530 --> 00:00:34,990
OK.

12
00:00:35,040 --> 00:00:40,800
But the wrap content attribute actually wraps this button around its contents.

13
00:00:40,800 --> 00:00:41,420
OK.

14
00:00:42,250 --> 00:00:45,550
Laps the width of this button around its content.

15
00:00:45,550 --> 00:00:50,190
So let's actually change this value to match parent.

16
00:00:50,260 --> 00:00:51,820
So hopefully that makes sense.

17
00:00:51,820 --> 00:00:57,600
Let's actually go inside this main activity that Java here and here we can actually put our own codes

18
00:00:57,610 --> 00:00:58,240
here.

19
00:00:58,630 --> 00:01:02,830
So as you can see here we need to actually free different classes here.

20
00:01:03,040 --> 00:01:08,860
A class called vehicle or class called car and a class called motorcycle OK.

21
00:01:09,040 --> 00:01:12,800
So let's actually create these free classes.

22
00:01:12,850 --> 00:01:13,420
OK.

23
00:01:13,480 --> 00:01:17,270
Now we want to actually create free different classes.

24
00:01:17,650 --> 00:01:23,300
So let's actually click on View tool windows and then click on Project.

25
00:01:23,310 --> 00:01:30,660
So here just click on this package here as you can see and then click on File New and then click on

26
00:01:30,840 --> 00:01:31,790
Java class.

27
00:01:31,800 --> 00:01:32,550
OK.

28
00:01:32,970 --> 00:01:38,410
So for the name of the class just type in here vehicle K..

29
00:01:38,510 --> 00:01:42,590
And now let's actually create another class called card.

30
00:01:42,650 --> 00:01:47,260
So just click on this package here find new jobs class.

31
00:01:47,320 --> 00:01:47,850
OK.

32
00:01:47,890 --> 00:01:55,970
Car as you can see here are car class is created again we need to actually create another class called

33
00:01:56,190 --> 00:01:57,330
motor cycle.

34
00:01:57,620 --> 00:01:59,550
So just click on this package here.

35
00:01:59,810 --> 00:02:01,550
File New.

36
00:02:01,730 --> 00:02:06,180
And then click on Jobar class motor cycle.

37
00:02:06,720 --> 00:02:07,750
OK.

38
00:02:08,210 --> 00:02:09,900
So this is our motorcycle class.

39
00:02:09,920 --> 00:02:10,660
OK.

40
00:02:11,360 --> 00:02:14,600
So let's actually work on this vehicle class here.

41
00:02:14,600 --> 00:02:20,660
This class is going to be the superior class for these two classes for this motorcycle class and for

42
00:02:20,660 --> 00:02:29,120
the car class as you know the car is actually a vehicle and a motorcycle is actually again a vehicle.

43
00:02:29,120 --> 00:02:29,680
OK.

44
00:02:29,900 --> 00:02:32,150
So let's first work on this.

45
00:02:32,280 --> 00:02:39,640
Plus here first of all I want to actually put in some instance variables that are related to this vehicle

46
00:02:39,640 --> 00:02:40,630
class.

47
00:02:41,110 --> 00:02:41,650
OK.

48
00:02:41,740 --> 00:02:47,520
Now we need to actually specify the instance variables that are related to these very vehicle class.

49
00:02:47,530 --> 00:02:48,040
OK.

50
00:02:48,100 --> 00:02:51,910
So the first instance variable is going to be the speed.

51
00:02:51,940 --> 00:02:52,690
OK.

52
00:02:52,930 --> 00:03:01,210
So first we need to actually specify the access modifier of this instance variable private's and the

53
00:03:01,210 --> 00:03:07,460
data type of this instance variable is eans and the name of this instance variable is speed.

54
00:03:07,690 --> 00:03:08,990
OK.

55
00:03:09,700 --> 00:03:13,570
Private and all vehicles have a braking system.

56
00:03:13,660 --> 00:03:14,040
OK.

57
00:03:14,080 --> 00:03:18,850
So I can just create a boolean variable has braking

58
00:03:23,580 --> 00:03:30,990
and because we are sure that all vehicles have a braking system we can actually make this variable a

59
00:03:30,990 --> 00:03:31,670
constant.

60
00:03:31,680 --> 00:03:36,840
OK so private fine on Boullion has braking system.

61
00:03:36,990 --> 00:03:39,090
All vehicles have vehicles.

62
00:03:39,270 --> 00:03:39,780
OK.

63
00:03:39,900 --> 00:03:49,590
So private int and the name of this instance variable is the number of vehicles.

64
00:03:49,590 --> 00:03:56,020
OK so now let's actually create a constructor for this vehicle class.

65
00:03:56,040 --> 00:04:02,850
So first of all I need to actually specify the access modifier of the constructor and the name of this

66
00:04:02,850 --> 00:04:07,450
constructor must be the same as the name of this class vehicle.

67
00:04:07,960 --> 00:04:08,780
OK.

68
00:04:09,090 --> 00:04:14,580
And then I need to actually put in a pair of round brackets after my constructor name and then I need

69
00:04:14,580 --> 00:04:19,000
to open and close my constructed by using these curly braces.

70
00:04:19,350 --> 00:04:25,890
So inside these Apprentice's I can actually specify some arguments the data type of the first argument

71
00:04:25,890 --> 00:04:34,350
is int and the name of this argument is speed comma and the data type of the second argument is boolean

72
00:04:35,190 --> 00:04:43,890
and the name of this argument is has braking system comma and the name of this first instance variable

73
00:04:43,890 --> 00:04:47,950
is number of years and it is of type int.

74
00:04:47,970 --> 00:04:53,640
So first I need to actually specify the data type of this argument and the name of this argument is

75
00:04:53,970 --> 00:04:54,860
number of years.

76
00:04:54,870 --> 00:04:55,360
OK.

77
00:04:55,560 --> 00:05:03,450
So inside this constructor First we need to actually specify that the constructor of the superclass

78
00:05:03,450 --> 00:05:04,600
is initialized.

79
00:05:04,890 --> 00:05:11,790
So as you know this vehicle class is implicitly inheriting all of the features and behaviors that are

80
00:05:11,970 --> 00:05:20,020
inside the object class and because inside the object class you have actually a default constructor

81
00:05:20,040 --> 00:05:23,390
we have a constructor without no parameters.

82
00:05:23,440 --> 00:05:29,450
The compiler is going to actually implicitly initialize that constructor for us.

83
00:05:29,490 --> 00:05:34,290
OK we can explicitly initialized as constructed by just typing here super.

84
00:05:34,490 --> 00:05:38,700
OK but if you don't put this a line of code here.

85
00:05:38,790 --> 00:05:43,870
The compiler is going to actually initialize the constructor of the superclass automatically for us.

86
00:05:43,910 --> 00:05:49,920
OK so we don't need to actually initialize that constructor only to actually initialize my own instance

87
00:05:49,920 --> 00:05:53,050
variables inside this constructor.

88
00:05:53,250 --> 00:06:00,480
So this does speed assignment operator speed.

89
00:06:00,780 --> 00:06:14,070
Semicolon this that has braking system assignment operator has Brahim system and this dot number of

90
00:06:14,070 --> 00:06:18,160
Veals assignments operator number of wheels.

91
00:06:18,200 --> 00:06:20,000
OK so hopefully that makes sense.

92
00:06:20,020 --> 00:06:25,510
And now let's actually create setters and getters for these instance variables.

93
00:06:25,530 --> 00:06:32,070
So inside this vehicle class and outside of these constructed just right click here and then click on

94
00:06:32,070 --> 00:06:40,140
generate and then we can get her and set her Sahir select all of these instance variables and then click

95
00:06:40,140 --> 00:06:44,910
on OK these getters and setters are actually created automatically for us.

96
00:06:44,910 --> 00:06:46,470
Get speed set speed.

97
00:06:46,470 --> 00:06:51,520
Is has braking system get number of visas and set number of wheels.

98
00:06:51,570 --> 00:06:57,730
So let's actually delete this is here and just put in the word get here.

99
00:06:57,870 --> 00:07:05,550
Get has braking system and then let's actually create an instance Smurfette for this vehicle class so

100
00:07:05,550 --> 00:07:09,150
we can actually create a method called right.

101
00:07:09,190 --> 00:07:11,530
OK Puplick void.

102
00:07:12,100 --> 00:07:14,410
Right OK.

103
00:07:15,090 --> 00:07:20,700
And then I put in a pair of round brackets after my Meffert name and then I open and close the Smurfette

104
00:07:20,960 --> 00:07:23,010
by using these curly braces.

105
00:07:23,040 --> 00:07:26,340
So here we can actually put in our own quotes.

106
00:07:26,430 --> 00:07:35,250
OK so make sure that inside of your own class to choose the getters and setters in order to access the

107
00:07:35,250 --> 00:07:37,000
value of this instance variables.

108
00:07:37,020 --> 00:07:42,070
OK in this way your quotes are going to be more maintainable and it is more secure.

109
00:07:42,330 --> 00:07:46,590
So now I want to actually produce an integer value.

110
00:07:46,770 --> 00:07:49,690
So end result.

111
00:07:50,070 --> 00:07:51,790
Assignment operator.

112
00:07:52,020 --> 00:08:02,960
And then I can actually multiply the value of this speed instance variable by the value of this number

113
00:08:02,960 --> 00:08:12,450
of violists OK so I can't just refer to the good term if it gets speed multiplied by jets number of

114
00:08:12,450 --> 00:08:12,780
wheels.

115
00:08:12,790 --> 00:08:19,800
OK so in this way you are actually referring to these guitars in order to access the value of this instance

116
00:08:19,800 --> 00:08:20,370
variables.

117
00:08:20,370 --> 00:08:21,640
OK this is a better way.

118
00:08:21,660 --> 00:08:29,810
In order to actually this the value of your instance variables always use getters or stars in order

119
00:08:29,810 --> 00:08:33,290
to manipulate the value of these instance variables.

120
00:08:33,300 --> 00:08:34,050
OK.

121
00:08:34,280 --> 00:08:39,910
And now I can actually create another instance variable here.

122
00:08:40,100 --> 00:08:47,690
For example private int and the name of this instance variable is the right speed.

123
00:08:48,040 --> 00:08:48,720
OK.

124
00:08:48,950 --> 00:08:52,550
And then I put in an assignment operator here.

125
00:08:52,640 --> 00:08:54,770
I actually put in a semicolon here.

126
00:08:54,770 --> 00:08:55,310
OK.

127
00:08:55,430 --> 00:09:03,110
So as you can see here now we can actually assign the value of this result local variable.

128
00:09:03,110 --> 00:09:09,950
So remember this result variable is actually a local variable because it is local to this method only

129
00:09:09,960 --> 00:09:10,440
OK.

130
00:09:10,520 --> 00:09:13,990
We cannot refer to this method from anywhere inside this class.

131
00:09:14,030 --> 00:09:14,640
OK.

132
00:09:14,780 --> 00:09:18,230
We can actually refer to this variable only inside this method.

133
00:09:18,380 --> 00:09:25,280
So now I can actually refer to the name of the write speed instance variable assignment operator result.

134
00:09:25,460 --> 00:09:27,460
So hopefully that makes sense.

135
00:09:27,500 --> 00:09:34,370
Let's actually only create a I'll get my head for this right speed instance variable just right here

136
00:09:34,520 --> 00:09:41,600
inside this vehicle class and then they can generate getter OK.

137
00:09:41,720 --> 00:09:44,660
I just want to create a getter for this right.

138
00:09:44,660 --> 00:09:46,580
Speed instance variable.

139
00:09:46,580 --> 00:09:47,120
OK.

140
00:09:47,300 --> 00:09:48,900
And then click on OK.

141
00:09:49,370 --> 00:09:55,430
So as you can see here now we have a getter method for this right speed instance variable.

142
00:09:55,520 --> 00:10:00,460
We can actually access the value of this right speed instance variable by using this method.

143
00:10:00,470 --> 00:10:01,030
OK.

144
00:10:01,150 --> 00:10:02,260
Get right speed.

145
00:10:02,270 --> 00:10:03,750
So hopefully that makes sense.

