1
00:00:00,450 --> 00:00:07,500
So as you can see here these are the lines of code that I pasted here inside this Anchal each method.

2
00:00:07,530 --> 00:00:14,780
So here in line number 100 I created a variable of type integer and the name of this variable is computed

3
00:00:14,780 --> 00:00:17,440
of power integer value.

4
00:00:17,550 --> 00:00:18,350
Right.

5
00:00:18,390 --> 00:00:24,720
So let's actually go inside this computer class as you can see inside this file computer the java file

6
00:00:24,720 --> 00:00:27,980
as you can see we have this instance variables right.

7
00:00:28,200 --> 00:00:34,260
But as you can see here we have free instance variables that are of type integer.

8
00:00:34,260 --> 00:00:35,070
Right.

9
00:00:35,070 --> 00:00:37,380
So let's go back to our main activity class.

10
00:00:37,470 --> 00:00:43,860
So here as you can see I created this variable which is of type integer here so that we can actually

11
00:00:45,180 --> 00:00:53,550
hold the value of this computer power which is going to be streamed inside these variable.

12
00:00:53,550 --> 00:00:57,030
So it computer power integer value.

13
00:00:57,120 --> 00:00:57,660
Right.

14
00:00:57,660 --> 00:00:59,620
Assignment operator operator zero.

15
00:00:59,700 --> 00:01:05,180
So initially I assigned the value zero to this valuable in line number one hundred and one.

16
00:01:05,280 --> 00:01:11,430
We created another variable which is again an integer and the name of this value but is computer speed

17
00:01:11,460 --> 00:01:17,410
integer value assignment operator 0 and inline number of 100 and 2.

18
00:01:17,580 --> 00:01:23,010
As you can see here we have another variable which is again of type integer and the name of this rowdier

19
00:01:23,030 --> 00:01:27,370
but is computerdom integer value assignment operator 0.

20
00:01:27,630 --> 00:01:35,820
So because these variables are of type integer we created them so that they can actually hold these

21
00:01:35,820 --> 00:01:36,860
integer values.

22
00:01:36,870 --> 00:01:43,590
So if I go inside this computer class as you can see here we have these instance variables that are

23
00:01:43,590 --> 00:01:44,520
of type integer.

24
00:01:44,670 --> 00:01:47,870
So insight is Anklage method inside the main activity class.

25
00:01:47,970 --> 00:01:55,710
We created these variables in horde in order to actually hold the the integer value of our computer

26
00:01:55,710 --> 00:01:56,380
power.

27
00:01:56,550 --> 00:01:57,140
Right.

28
00:01:57,240 --> 00:02:01,930
So now we need to actually convert our string value to an integer value.

29
00:02:01,950 --> 00:02:03,440
So let's see how we can do that.

30
00:02:03,450 --> 00:02:08,670
First let me just pasting some lines of code here and then it will make sense.

31
00:02:08,670 --> 00:02:13,230
So as you can see here these are the lines of code that I pasted here.

32
00:02:13,410 --> 00:02:15,930
So we have a try catch block here.

33
00:02:15,990 --> 00:02:16,770
Right.

34
00:02:16,770 --> 00:02:19,810
So let's actually look at this tree block here.

35
00:02:19,920 --> 00:02:24,570
So try and inside the curly braces of these tribal Arch we have this line of code here.

36
00:02:24,900 --> 00:02:32,750
So here I am referring to this valuable computer power integer value assignment operator here.

37
00:02:33,210 --> 00:02:38,330
And then I am referring to the name of this integer class that parse it.

38
00:02:38,340 --> 00:02:40,980
So what does this parse method do this.

39
00:02:40,980 --> 00:02:47,580
If it is going to actually convert a value that is of types 3 to an integer value but it doesn't mean

40
00:02:47,640 --> 00:02:54,850
that if you actually for example pass the value hello to this method it's not going to actually convert

41
00:02:54,900 --> 00:02:57,550
that hello to the to an integer value.

42
00:02:57,720 --> 00:02:58,380
It's just going on.

43
00:02:58,380 --> 00:03:06,980
For example if you pass for example Number 25 to an it takes as you can see here in line number 94.

44
00:03:07,140 --> 00:03:09,170
We have this variable which is of type string.

45
00:03:09,180 --> 00:03:09,500
Right.

46
00:03:09,510 --> 00:03:13,840
And the name of this value is computer power assignment operator.

47
00:03:13,860 --> 00:03:17,220
So here I am referring to the EDT computer power.

48
00:03:17,370 --> 00:03:24,510
So now let me show you the emulator here as I can see this is our emulator and this is our ADC computer

49
00:03:24,510 --> 00:03:25,560
power right.

50
00:03:25,600 --> 00:03:31,560
The user is supposed to actually enter an integer value here.

51
00:03:31,560 --> 00:03:33,640
For example number 23 right.

52
00:03:33,690 --> 00:03:40,500
But if the user enters For example a value that is not an integer for example hello then it's not going

53
00:03:40,500 --> 00:03:43,840
to actually convert this value to an integer value.

54
00:03:43,920 --> 00:03:45,320
It's going to run an error.

55
00:03:45,330 --> 00:03:45,840
Right.

56
00:03:46,050 --> 00:03:51,150
So that's why we actually put this line of code here inside a try block.

57
00:03:51,600 --> 00:03:54,440
And we have also this catch block here.

58
00:03:54,660 --> 00:03:58,210
In order to catch any errors that may occur here.

59
00:03:58,230 --> 00:04:04,430
So for example the user is supposed to actually enter an integer value here for the computer power.

60
00:04:04,560 --> 00:04:09,030
But what happens if the user for example enters the value Hello.

61
00:04:09,300 --> 00:04:12,660
In that case we have an error and it's going to throw an error.

62
00:04:12,780 --> 00:04:17,570
And if we don't get that error our application is going to crash.

63
00:04:17,670 --> 00:04:18,070
Right.

64
00:04:18,120 --> 00:04:19,940
And we don't want that to happen.

65
00:04:19,950 --> 00:04:21,680
We don't want our application to crash.

66
00:04:21,810 --> 00:04:25,440
So we should actually just catch those errors.

67
00:04:25,620 --> 00:04:29,530
So that's why I actually created this try catch block here.

68
00:04:29,610 --> 00:04:34,220
So any time that you may actually expect something to go run.

69
00:04:34,380 --> 00:04:41,760
Make sure to put your own codes inside a truck try church block so that they can actually get those

70
00:04:41,850 --> 00:04:43,830
errors in say the catch block.

71
00:04:43,980 --> 00:04:44,910
Right.

72
00:04:44,910 --> 00:04:47,110
Look at this block I've got here.

73
00:04:47,110 --> 00:04:50,460
Try computer power assignment operator.

74
00:04:50,490 --> 00:04:55,980
So here I am referring to this integer class right integer that parse it.

75
00:04:56,280 --> 00:05:02,240
So again let me tell you that this parts ain't gonna actually convert a value that is of types three

76
00:05:02,460 --> 00:05:03,360
integer value.

77
00:05:03,360 --> 00:05:09,840
Right but for example if I if I here enter the value of 100 here this is going to be an integer value

78
00:05:09,840 --> 00:05:10,260
right.

79
00:05:10,350 --> 00:05:14,170
But here we put this integer value inside these Eadie text.

80
00:05:14,220 --> 00:05:15,010
Right.

81
00:05:15,090 --> 00:05:18,280
And it it takes can only accept a string value.

82
00:05:18,300 --> 00:05:25,520
So it's going actually to convert that value to our street you and we can actually put it here right.

83
00:05:25,620 --> 00:05:28,670
And then we are actually saying that get picks that twisted in.

84
00:05:28,680 --> 00:05:33,900
So it's going to convert that value to run twice think value and it's going to assign that string value

85
00:05:33,900 --> 00:05:35,260
to these computer power.

86
00:05:35,460 --> 00:05:38,830
So this 100 here now is our string value right.

87
00:05:39,030 --> 00:05:41,820
But if we want an integer value.

88
00:05:41,940 --> 00:05:43,610
So here inside is Triple H.

89
00:05:43,740 --> 00:05:45,210
We are converting.

90
00:05:45,300 --> 00:05:50,760
We are saying that convert that integer value to that string value to an integer value.

91
00:05:50,760 --> 00:05:55,490
Here we are saying that converts that string value computer power to an integer value.

92
00:05:55,530 --> 00:06:00,330
So integer parsing computer power that's here right.

93
00:06:00,330 --> 00:06:06,300
So it's going to convert the value of 120 integer value not and not passing value about an integer value

94
00:06:06,660 --> 00:06:13,070
and it's going to assign that integer value to this computer power integer value valuable.

95
00:06:13,350 --> 00:06:13,870
Right.

96
00:06:14,100 --> 00:06:17,100
So if you have this try catch block for disvalue.

97
00:06:17,460 --> 00:06:20,430
So now we have two other variables here.

98
00:06:20,460 --> 00:06:23,630
As you can see this one computer spit integer value.

99
00:06:23,640 --> 00:06:28,500
So let's actually create a try catch block for this one computer with integer value.

100
00:06:28,500 --> 00:06:30,710
And here I can say try.

101
00:06:31,170 --> 00:06:35,010
And then I can open and close describe like by using these curly braces.

102
00:06:35,010 --> 00:06:42,600
And we also must provide a check or catch block so catch and inside the prentices again to say exception

103
00:06:43,410 --> 00:06:45,970
and the name of this argument is going to be.

104
00:06:46,420 --> 00:06:50,660
And here I can open and close this catch block by using these curly braces.

105
00:06:50,820 --> 00:06:57,060
So in this way we can actually write our coats inside this Triple H and inside the catch block we can

106
00:06:57,060 --> 00:06:58,720
catch those errors.

107
00:06:59,010 --> 00:07:05,240
And in that case our application is not going to crash because we already caught the errors right.

108
00:07:05,280 --> 00:07:14,370
So in say the Triple H I can say Computer computer speed integer value assignment operator and that

109
00:07:14,520 --> 00:07:19,970
refers to the name of this class Integer class that parts Int.

110
00:07:20,100 --> 00:07:25,040
And here I can easily refer to the name of this valuable computer speed.

111
00:07:25,080 --> 00:07:32,490
So here inside the prentices I can pass disvalue computer speed and then I need to put a semicolon at

112
00:07:32,490 --> 00:07:33,600
the end of my statement.

113
00:07:33,750 --> 00:07:39,810
And inside these catch block again just like does this error to the console.

114
00:07:39,810 --> 00:07:47,070
So here I can say larg that I first I need to specify the tag which is going to be all of types think.

115
00:07:47,260 --> 00:07:50,420
And here I can say the I am referring to these arguments right.

116
00:07:50,430 --> 00:07:54,790
This argument actually holds the actual error description.

117
00:07:54,790 --> 00:08:02,520
So for example dot get localized message or get a message and then put a semicolon at the end of your

118
00:08:02,520 --> 00:08:03,770
statement.

119
00:08:04,110 --> 00:08:09,160
So they provided a try catch block for this valuable computer spit into the value.

120
00:08:09,160 --> 00:08:13,400
And now let's actually create another try catch block for our.

121
00:08:13,450 --> 00:08:18,590
Another variable which is just one computer rammy integer values so try.

122
00:08:18,910 --> 00:08:21,770
And here I need to provide a catch block.

123
00:08:22,110 --> 00:08:27,710
So now exception inside Apprentice's just put the value exception E..

124
00:08:28,260 --> 00:08:31,470
And then open and close your cataplexy by using curly braces.

125
00:08:31,470 --> 00:08:37,770
And inside is trouble like I can't say the name of what a variable is computer integer value computer

126
00:08:39,350 --> 00:08:43,360
ram integer value assignment operator.

127
00:08:43,410 --> 00:08:47,640
And here I can say integer dot parts in it.

128
00:08:48,180 --> 00:08:54,610
And here I can pass these valuable as you can see here Computerland which is strange.

129
00:08:54,690 --> 00:08:58,650
So here I can see inside the Prentice's computer

130
00:09:01,910 --> 00:09:03,200
RAM.

131
00:09:03,850 --> 00:09:08,740
And then I need to put a semicolon at the end of my statement and in say the catch block I can catch

132
00:09:08,740 --> 00:09:11,800
that error and just put it in the console.

133
00:09:11,800 --> 00:09:16,420
So like that by first I need to specify the task.

134
00:09:16,570 --> 00:09:24,830
And here I can see the dot get message and then I need to put a semicolon at the end of my statement.

135
00:09:25,390 --> 00:09:27,610
So hopefully that makes sense.

