1
00:00:00,360 --> 00:00:04,710
Hire everyone in this theater early on I'm going to talk about inheritance in Java.

2
00:00:04,710 --> 00:00:11,760
So first of all let me point out that inheritance is one of the features of object oriented programming.

3
00:00:12,060 --> 00:00:18,170
Inheritance allows a class to use the properties and methods of another class.

4
00:00:18,180 --> 00:00:18,710
OK.

5
00:00:18,720 --> 00:00:26,550
In other words that the right class inherits this Tait's and behaviors from the base class.

6
00:00:26,550 --> 00:00:32,460
So for example we have two classes in our project and we can actually specify the base class and the

7
00:00:32,460 --> 00:00:40,950
D-Rays class and the deprived class can inherit the states and behaviors from the base class which I'll

8
00:00:40,950 --> 00:00:42,290
talk more about later.

9
00:00:42,390 --> 00:00:42,850
OK.

10
00:00:42,900 --> 00:00:50,810
That 0 2 class is also called subclass and the base class is also known as superclass.

11
00:00:50,850 --> 00:00:51,400
OK.

12
00:00:51,450 --> 00:00:59,280
So the desired class can add its own additional variables and Misfit's is additional valuable and Milford's

13
00:00:59,580 --> 00:01:03,700
differentiates the derived class from the base class.

14
00:01:03,720 --> 00:01:12,000
OK a simple class can have any number of subclasses but a subclass can have only one superclass.

15
00:01:12,010 --> 00:01:16,140
OK so this is because Java does not support multiple inheritance.

16
00:01:16,150 --> 00:01:22,910
OK this superclass and subclass have is a relationship between them.

17
00:01:22,920 --> 00:01:26,050
So now like let me actually show you a real example OK.

18
00:01:26,710 --> 00:01:31,090
OK so now let's actually consider a superclass called a shape.

19
00:01:31,110 --> 00:01:31,810
OK.

20
00:01:32,030 --> 00:01:35,920
Different shapes have different features and properties.

21
00:01:35,990 --> 00:01:39,480
However are few of them are common to all.

22
00:01:39,480 --> 00:01:44,310
For example the color of the shape the size of the shape or other properties.

23
00:01:44,340 --> 00:01:44,950
OK.

24
00:01:45,030 --> 00:01:53,550
Hence as a result we can create a class called Shape with states and actions that are common to all

25
00:01:53,640 --> 00:01:54,140
shapes.

26
00:01:54,150 --> 00:01:54,620
OK.

27
00:01:54,660 --> 00:01:59,340
So as you can see here we've got two dimensional shapes and for dimensional shapes.

28
00:01:59,340 --> 00:02:00,010
OK.

29
00:02:00,030 --> 00:02:04,220
The circle shape is a subclass of the two dimensional shape.

30
00:02:04,230 --> 00:02:07,490
The square shape is the subclass of two dimensional shape.

31
00:02:07,710 --> 00:02:13,640
And this triangle shape is a subclass of these two diminished two dimensional shape.

32
00:02:13,640 --> 00:02:14,620
Class OK.

33
00:02:14,760 --> 00:02:18,400
And on the other hand we've got three dimensional shapes.

34
00:02:18,420 --> 00:02:21,760
The sphere class is the subclass of three dimensional shape.

35
00:02:21,780 --> 00:02:25,960
The Cube class is a subclass of freedom and Shannons shape.

36
00:02:25,980 --> 00:02:30,380
And the pyramid class is the subclass of freedom engine shape.

37
00:02:30,380 --> 00:02:31,100
OK.

38
00:02:31,440 --> 00:02:37,850
As you can see here this two dimensional shape class inherits all the features and behaviors of this

39
00:02:37,850 --> 00:02:43,520
Shape class and this class can have its own behaviors or methods.

40
00:02:43,530 --> 00:02:47,570
OK these two dimensional shape class and down the hierarchy.

41
00:02:47,640 --> 00:02:55,980
This circle class inherits all the features and behaviors of these two dimensional shape class and this

42
00:02:55,980 --> 00:02:56,430
class.

43
00:02:56,430 --> 00:03:04,260
This circle class can have its own merits and features specific to the Circle class Square class.

44
00:03:04,260 --> 00:03:09,840
Again it inherits all the features and behaviors of the two dimensional shape class and it can have

45
00:03:10,440 --> 00:03:16,230
its own features and behaviors specific to this square class.

46
00:03:16,230 --> 00:03:22,840
Again the triangular class inherits all the features and behaviors of the two dimensional shape class.

47
00:03:22,980 --> 00:03:29,000
But it can have its own features and behaviors specific to this triangular class.

48
00:03:29,100 --> 00:03:35,250
And again this Fredy mention on Shape class inherits all the features and behaviors of the Shape class

49
00:03:35,310 --> 00:03:42,510
but it can have its own features and behaviors specific to that freedom in general shape glass and down

50
00:03:42,510 --> 00:03:48,600
the hierarchy as you can see this sphere class inherits all the features and behaviors of the three

51
00:03:48,600 --> 00:03:50,220
dimensional shape class.

52
00:03:50,220 --> 00:03:58,530
But it can have its own features and behaviors specific to the US sphere class and this new class inherits

53
00:03:58,920 --> 00:04:04,470
all the features and behaviors of the three dimensional shape class but it can have its own features

54
00:04:04,500 --> 00:04:07,530
and behaviors specific to this cube class.

55
00:04:07,710 --> 00:04:11,140
And it's the same story for this pyramid class.

56
00:04:11,160 --> 00:04:11,660
OK.

57
00:04:11,730 --> 00:04:18,510
But for example this triangular class cannot inherit the features or behaviors of these three dimensional

58
00:04:18,510 --> 00:04:24,680
shape class because it doesn't inherit features or behaviors of this class.

59
00:04:24,690 --> 00:04:25,260
OK.

60
00:04:25,410 --> 00:04:32,970
The triangle class can only inherit the features or behaviors of the two dimensional shape class or

61
00:04:32,970 --> 00:04:36,670
it can inherit the features or behaviors of the Shape class.

62
00:04:36,690 --> 00:04:37,120
OK.

63
00:04:37,140 --> 00:04:41,480
So here as you can see the two dimensional shape class is a shape.

64
00:04:41,520 --> 00:04:42,070
OK.

65
00:04:42,180 --> 00:04:45,930
And this circle class is a two dimensional shape.

66
00:04:45,930 --> 00:04:52,890
This square class is a two dimensional shape and this triangle class is actually a two dimensional shape.

67
00:04:52,890 --> 00:04:53,940
So as a result.

68
00:04:53,940 --> 00:04:59,490
So as you can see there is a relationship between these classes that inherit from each other.

69
00:05:00,620 --> 00:05:04,970
And again it's the same story for this freedom in a class.

70
00:05:05,030 --> 00:05:08,420
So is freedom freedom and you know Shape class is a shape.

71
00:05:08,480 --> 00:05:08,840
OK.

72
00:05:08,850 --> 00:05:14,600
There is a relationship between these two classes because this freedom mention on the Shape class actually

73
00:05:14,600 --> 00:05:18,090
inherits behaviors or features of the Shape class.

74
00:05:18,110 --> 00:05:18,780
OK.

75
00:05:19,010 --> 00:05:25,850
And this sphere class actually is a three dimensional shape because it inherits the behaviors or features

76
00:05:26,150 --> 00:05:28,460
of this freedom emotional shape class.

77
00:05:28,610 --> 00:05:35,210
And we've got this our class actually this queue class is our freedom engine and shape and as a result

78
00:05:35,450 --> 00:05:36,560
it is a shape.

79
00:05:36,680 --> 00:05:37,260
OK.

80
00:05:37,310 --> 00:05:43,700
Because this cube class actually inherits that behaviors or features of these three dimensional shape

81
00:05:43,700 --> 00:05:50,010
class and Frady mention or Shape class inherits the behaviors and features of the Shape class.

82
00:05:50,030 --> 00:05:53,490
So as a result the cube class is a shape.

83
00:05:53,650 --> 00:05:54,140
OK.

84
00:05:54,170 --> 00:06:00,620
And we've got this pyramid class this PM class is actually a free dimensional shape and as a result

85
00:06:00,650 --> 00:06:02,420
it is a shape.

86
00:06:02,420 --> 00:06:03,020
OK.

87
00:06:03,260 --> 00:06:07,100
As you can see that is it is a relationship between these classes here.

88
00:06:07,100 --> 00:06:07,780
OK.

89
00:06:08,000 --> 00:06:10,190
So hopefully that makes sense.

90
00:06:10,190 --> 00:06:12,650
So now let me actually show you another example.

91
00:06:12,650 --> 00:06:19,060
So as you can see here we've got this Animal class here and this animal class is the base class.

92
00:06:19,070 --> 00:06:19,680
OK.

93
00:06:19,760 --> 00:06:26,100
So this chat class actually inherits all the features and behaviors of this Animal class.

94
00:06:26,120 --> 00:06:26,600
OK.

95
00:06:26,690 --> 00:06:30,740
So as a result this tath class is an animal.

96
00:06:30,890 --> 00:06:31,710
OK.

97
00:06:32,180 --> 00:06:37,970
And we've got this leopard class this leopard class actually inherits all the behaviors and features

98
00:06:38,330 --> 00:06:45,770
of this cat class and this cat class inherits all the all the features and behaviors of this Animal

99
00:06:45,770 --> 00:06:46,500
class.

100
00:06:46,520 --> 00:06:53,570
So as a result this leper's class is a cat and it is also an animal.

101
00:06:53,770 --> 00:06:54,310
OK.

102
00:06:54,410 --> 00:06:58,510
Because this leopard class inherits all the features of this cat class.

103
00:06:58,730 --> 00:07:03,620
And so as a result it is a cat and it is also an animal.

104
00:07:03,740 --> 00:07:05,210
So hopefully that makes sense.

105
00:07:05,360 --> 00:07:13,210
So now let's actually go inside the anthrax and create are actually our fourth Android application.

106
00:07:13,240 --> 00:07:13,580
OK.

107
00:07:13,580 --> 00:07:19,500
Now let's actually open the Android studio and then click on start a new Android studio project.

108
00:07:19,720 --> 00:07:23,720
And then we need to actually specify a name for an application name.

109
00:07:23,950 --> 00:07:25,720
So just type in here before.

110
00:07:25,960 --> 00:07:32,190
And then here we need to actually specify a name for an application name app for and here specifically

111
00:07:32,290 --> 00:07:33,310
the company domain.

112
00:07:33,400 --> 00:07:39,850
And here you can specify the package name by clicking on the edit here and then you can actually specify

113
00:07:39,910 --> 00:07:41,270
the project location here.

114
00:07:41,290 --> 00:07:42,280
OK.

115
00:07:42,400 --> 00:07:43,680
And then click on next.

116
00:07:43,960 --> 00:07:50,720
So here make sure that you choose the API 16 Android what wanted it been for your minimum and then click

117
00:07:50,720 --> 00:07:51,600
on next.

118
00:07:51,880 --> 00:07:55,060
And here choose the blank activity and then click next.

119
00:07:55,210 --> 00:08:01,540
And here this is the this is the activity name main activity you can you can change this name if you

120
00:08:01,540 --> 00:08:02,380
want.

121
00:08:02,380 --> 00:08:06,250
This is our lay out name as you can see activity underline main.

122
00:08:06,610 --> 00:08:10,560
And this is the title main activity for our application.

123
00:08:10,570 --> 00:08:13,860
As you can see and this is the manual resource name.

124
00:08:13,870 --> 00:08:18,260
So I recommend that you don't change these names here and then click on finish.

125
00:08:18,610 --> 00:08:23,050
So as you can see here it can actually create our Android application for us.

126
00:08:23,170 --> 00:08:26,890
So first it's going to actually configure and set up the application.

127
00:08:27,100 --> 00:08:27,430
OK.

128
00:08:27,430 --> 00:08:30,990
Now as you can see our Android project is created.

129
00:08:31,270 --> 00:08:35,150
So as you can see here it's now showing us that error again.

130
00:08:35,200 --> 00:08:41,470
So we need to click on these cradle squits here and then click on this build that cradle here and then

131
00:08:41,470 --> 00:08:47,180
change change this number to number one and change this number change this number to number one.

132
00:08:47,200 --> 00:08:47,790
OK.

133
00:08:48,040 --> 00:08:52,220
So click on this scene now here and then let's go back inside.

134
00:08:52,300 --> 00:08:56,860
Inside the content underline mean that excitement as you can see now the error is gone.

135
00:08:56,890 --> 00:08:57,530
OK.

136
00:08:57,850 --> 00:09:01,740
So let's go inside the main activity that job right here.

137
00:09:01,840 --> 00:09:05,470
And as you can see let's actually delete these lines of code here.

138
00:09:06,310 --> 00:09:08,230
I'll talk more about these options.

139
00:09:08,240 --> 00:09:15,250
But for now I don't want to actually create many options in our application and here really these floating

140
00:09:15,250 --> 00:09:17,080
action Potten here.

141
00:09:17,680 --> 00:09:21,330
So let's actually go back inside the press folder here.

142
00:09:21,550 --> 00:09:28,190
And then double click on this layout folder here and then double click on this activity underline mean

143
00:09:28,200 --> 00:09:29,430
that Semmel OK.

144
00:09:29,920 --> 00:09:38,680
So click on this text tab here and then delete these lines of code here which is related to the float

145
00:09:39,000 --> 00:09:40,480
float in action button here.

146
00:09:40,480 --> 00:09:40,960
OK.

147
00:09:41,080 --> 00:09:41,440
OK.

148
00:09:41,440 --> 00:09:44,570
Now let's actually close this window here.

149
00:09:44,590 --> 00:09:46,730
This activity underline made that example.

150
00:09:46,900 --> 00:09:48,800
So just click on this X here.

151
00:09:48,850 --> 00:09:50,060
As you can see.

152
00:09:50,740 --> 00:09:55,250
So as you can see this is our main active main activity that job here.

