1
00:00:00,230 --> 00:00:05,110
Hi everyone in this theater early on I'm going to touch about logical operators.

2
00:00:05,130 --> 00:00:05,650
OK.

3
00:00:05,760 --> 00:00:08,250
So first we need to create a Java project.

4
00:00:08,340 --> 00:00:10,750
So just click on this file new.

5
00:00:11,250 --> 00:00:12,900
And then click on Java project.

6
00:00:12,900 --> 00:00:13,590
OK.

7
00:00:13,650 --> 00:00:16,110
So for the project name just type in here.

8
00:00:16,130 --> 00:00:19,530
Logical operators

9
00:00:22,450 --> 00:00:23,150
OK.

10
00:00:23,450 --> 00:00:25,210
And click on finish.

11
00:00:25,970 --> 00:00:29,500
So as you can see here our project is now created.

12
00:00:29,510 --> 00:00:35,540
So first we need a class for our project to just click on this as our See folder and then click on Phi

13
00:00:35,720 --> 00:00:37,770
new and then click on class.

14
00:00:38,210 --> 00:00:42,390
So for the class name just type in here logical operator

15
00:00:45,810 --> 00:00:49,930
Okay for the package name we need a reverse domain here.

16
00:00:50,050 --> 00:00:55,100
Just type in your column that your name dot project name ok.

17
00:00:55,810 --> 00:01:06,310
Logical operators are OK for the modifiers to publish and make sure that you check the check box here

18
00:01:06,570 --> 00:01:08,910
that says public static void main method.

19
00:01:08,920 --> 00:01:09,490
OK.

20
00:01:09,580 --> 00:01:11,390
And then click can finish.

21
00:01:11,590 --> 00:01:14,620
So as you can see here our project is now created.

22
00:01:14,620 --> 00:01:18,400
So first let me actually delete this comment here.

23
00:01:18,710 --> 00:01:24,100
And in order to make this a little area of there you just need to actually double click on this logical

24
00:01:24,100 --> 00:01:25,610
operator that job I have.

25
00:01:25,770 --> 00:01:26,290
OK.

26
00:01:26,350 --> 00:01:30,400
And here we can actually write our codes inside the main method.

27
00:01:30,700 --> 00:01:36,760
I'll talk more about the methods later in this course but for now I make sure that you write your code

28
00:01:36,850 --> 00:01:40,340
inside the curly braces of this main method.

29
00:01:40,360 --> 00:01:41,020
OK.

30
00:01:41,440 --> 00:01:43,750
So logical operators

31
00:01:47,690 --> 00:01:57,620
so expressions that result in boolean values such as comparison operators can be combined to form more

32
00:01:57,620 --> 00:01:59,040
complex expressions.

33
00:01:59,070 --> 00:02:05,250
OK this is handled through logical operators which are used for the logical combinations.

34
00:02:05,320 --> 00:02:08,000
OK so the first one is and.

35
00:02:08,390 --> 00:02:09,450
OK.

36
00:02:09,750 --> 00:02:17,460
Or the next one is Zaur and not.

37
00:02:17,750 --> 00:02:25,060
OK so now let me actually show you some real examples in order to make this concept more clear for you.

38
00:02:25,130 --> 00:02:28,500
OK so now you want to create a variable here.

39
00:02:28,530 --> 00:02:31,100
Ain't salary.

40
00:02:31,440 --> 00:02:31,880
OK.

41
00:02:31,950 --> 00:02:34,220
And then I assign a value to my variable.

42
00:02:34,230 --> 00:02:39,920
For example 2000 and I need to put a semicolon at the end of my variable here.

43
00:02:39,930 --> 00:02:40,510
OK.

44
00:02:40,590 --> 00:02:42,890
Now I want to create another variable here.

45
00:02:42,900 --> 00:02:43,470
OK.

46
00:02:43,590 --> 00:02:47,310
So the data type of my variable is boolean.

47
00:02:47,820 --> 00:02:48,380
OK.

48
00:02:48,690 --> 00:02:53,620
And the name of my variable is R for example is higher.

49
00:02:54,330 --> 00:02:54,900
OK.

50
00:02:55,050 --> 00:02:58,230
And then I want to assign a value to my variable here.

51
00:02:58,250 --> 00:03:06,230
OK so now I want to combine expressions together and then assign that value to my higher level here.

52
00:03:06,240 --> 00:03:13,560
OK so now I want to actually combine expressions together and then assign the value of those expressions

53
00:03:13,770 --> 00:03:15,280
to my highest value.

54
00:03:15,300 --> 00:03:17,370
OK so let's see how we can do that.

55
00:03:17,400 --> 00:03:17,920
OK.

56
00:03:18,150 --> 00:03:20,460
So first finish putting in parentheses.

57
00:03:20,460 --> 00:03:25,840
So now I want to actually referred to the name of my salary variable here.

58
00:03:26,040 --> 00:03:27,780
In order to read it's value.

59
00:03:27,780 --> 00:03:28,440
OK.

60
00:03:28,590 --> 00:03:30,390
So I just type in here salary.

61
00:03:30,550 --> 00:03:31,350
OK.

62
00:03:31,620 --> 00:03:36,540
So now I just put in a comparison operator here as you can see a greater than sign.

63
00:03:36,600 --> 00:03:37,420
OK.

64
00:03:37,860 --> 00:03:42,350
And then I put in a value here for example a thousand.

65
00:03:42,780 --> 00:03:46,100
So now I need to put in a semi-colon at the end of my statement.

66
00:03:46,150 --> 00:03:53,550
Ok here I am telling the computer if the value of this salary variable is greater than 1000 the value

67
00:03:53,550 --> 00:03:55,970
of the expression evaluates to TRUE.

68
00:03:56,060 --> 00:03:56,630
OK.

69
00:03:56,790 --> 00:04:06,720
But if the value of this salary variable is less than or equal to one 1000 the value of this expression

70
00:04:06,930 --> 00:04:11,310
as you can see here the value of this expression evaluates to false.

71
00:04:11,310 --> 00:04:11,970
OK.

72
00:04:12,150 --> 00:04:17,250
So let's actually output the value of these variables for the console and let's see what's going on

73
00:04:17,250 --> 00:04:17,750
here.

74
00:04:17,850 --> 00:04:22,980
System that out that princeling.

75
00:04:23,610 --> 00:04:29,370
And then inside the practices I just referred to the name of one variable in order to read its value.

76
00:04:29,370 --> 00:04:29,710
OK.

77
00:04:29,820 --> 00:04:33,290
And then at the end of my statement I need to put in a semi-colon OK.

78
00:04:33,420 --> 00:04:40,050
Again I want to output the value of this is higher variable to the console akey the value of this boolean

79
00:04:40,050 --> 00:04:43,150
variable that I created in line 17.

80
00:04:43,170 --> 00:04:43,790
Okay.

81
00:04:44,070 --> 00:04:52,890
So I just need to type in here system that out that line and then inside Apprentice's I just need to

82
00:04:52,890 --> 00:04:58,830
refer to the name of my variable and that at the end of my statement I need to put in a semicolon OK.

83
00:04:59,040 --> 00:05:06,860
So now if I run my project as you can see it's going to output these values to the consulate.

84
00:05:07,320 --> 00:05:10,740
So as you can see here the first one is disvalue.

85
00:05:10,740 --> 00:05:15,020
Here is the result of execution of this line of code here.

86
00:05:15,060 --> 00:05:15,780
OK.

87
00:05:15,930 --> 00:05:17,160
In line 15.

88
00:05:17,280 --> 00:05:26,610
So this value is the value of my salary variable that I created in line 14 and I decided to output the

89
00:05:26,610 --> 00:05:30,300
value of this variable to the console in line 50.

90
00:05:30,330 --> 00:05:31,640
OK.

91
00:05:32,310 --> 00:05:34,240
So orders does matter here.

92
00:05:34,250 --> 00:05:38,520
OK this is very important and in inline 17 as you can see here.

93
00:05:38,550 --> 00:05:42,150
I created another variable here with the boolean data type.

94
00:05:42,150 --> 00:05:42,850
OK.

95
00:05:42,990 --> 00:05:47,950
And this is the name of my variable is hired and I assigned a value to my variable here.

96
00:05:47,970 --> 00:05:48,420
OK.

97
00:05:48,540 --> 00:05:55,820
I created an expression here and I specified that salary must be greater than 1000.

98
00:05:55,830 --> 00:05:56,340
OK.

99
00:05:56,400 --> 00:06:03,740
If the salary is greater than 1000 the value of this expression evaluates to true and that true value

100
00:06:04,020 --> 00:06:06,040
will be assigned to my highest value.

101
00:06:06,040 --> 00:06:13,260
Well if the value of the side of the variable is less than or equal to one thousandth the value of this

102
00:06:13,260 --> 00:06:19,800
for expression evaluates to false and that false value will be assigned to my it is higher value.

103
00:06:20,190 --> 00:06:26,260
So in line 18 I decided to output the value of this is higher is the variable to the console.

104
00:06:26,490 --> 00:06:32,110
So as you can see here the value that I assigned to my salary evaluable is 2000.

105
00:06:32,130 --> 00:06:32,920
OK.

106
00:06:32,930 --> 00:06:40,050
And in this expression I specified that the value of the salary variable must be greater than 1000 in

107
00:06:40,050 --> 00:06:42,540
order to evaluate its expression true true.

108
00:06:42,600 --> 00:06:43,080
OK.

109
00:06:43,170 --> 00:06:45,650
So let's actually see what's in the console.

110
00:06:45,810 --> 00:06:49,540
As you can see the true value is now out to the console.

111
00:06:49,740 --> 00:06:55,650
So the value of this expression is evaluated to true because the value of the solidly value bet as you

112
00:06:55,650 --> 00:06:58,390
can see 2000 is greater than 1000.

113
00:06:58,470 --> 00:07:00,860
OK this expression evaluates to true.

114
00:07:01,230 --> 00:07:09,660
And that true value will be assigned to might is higher variable and in line 18 I decided to output

115
00:07:09,750 --> 00:07:13,010
the value of this is variable to the console.

116
00:07:13,160 --> 00:07:13,980
As you can see here.

117
00:07:14,010 --> 00:07:14,470
Okay.

118
00:07:14,540 --> 00:07:19,010
So now I want to actually combine two expressions together.

119
00:07:19,010 --> 00:07:19,550
Okay.

120
00:07:19,820 --> 00:07:23,930
So first let me actually comment out these lines of code here.

121
00:07:24,350 --> 00:07:25,120
Okay.

122
00:07:25,430 --> 00:07:32,300
And here I want to actually create another variable in for example the name of my variable with the

123
00:07:32,300 --> 00:07:33,260
money.

124
00:07:33,780 --> 00:07:35,130
Okay.

125
00:07:35,300 --> 00:07:39,880
And I want to assign a value to my variable for example 100.

126
00:07:39,980 --> 00:07:40,450
Okay.

127
00:07:40,550 --> 00:07:43,590
And then at the end of my statement I need to put in a semi-colon.

128
00:07:43,590 --> 00:07:44,100
Okay.

129
00:07:44,450 --> 00:07:50,450
So here I want to output the value of this valuable to the concert to make sure that it works.

130
00:07:50,450 --> 00:07:53,370
System that out that princeling.

131
00:07:53,780 --> 00:07:57,480
And then inside Apprentice's I just need to refer to the name of my variable.

132
00:07:57,590 --> 00:08:02,770
So let me actually put a text here in order to make this value more readable.

133
00:08:02,780 --> 00:08:11,170
This is the value of the money roudy of it.

134
00:08:11,270 --> 00:08:12,010
OK.

135
00:08:12,370 --> 00:08:17,200
And here after the double codes I need to put an A-plus operator here.

136
00:08:17,420 --> 00:08:17,710
OK.

137
00:08:17,710 --> 00:08:22,330
Because I want to concatenate this text here with my variable name.

138
00:08:22,360 --> 00:08:23,020
OK.

139
00:08:23,170 --> 00:08:31,430
So I just need to type in here money and at the end of my statement I need to put in a semi-colon OK.

140
00:08:31,810 --> 00:08:39,880
So if I run my project now as you can see there is no space between this valuable vote here and the

141
00:08:39,880 --> 00:08:41,090
value of my value.

142
00:08:41,210 --> 00:08:49,060
And so here I need to actually create a space here after the variable vort and if I run my project again

143
00:08:49,120 --> 00:08:51,540
this space is now created here.

144
00:08:52,090 --> 00:08:57,960
So this is the value of the money variable 100 as you can see.

145
00:08:58,230 --> 00:08:58,810
OK.

146
00:08:58,990 --> 00:09:01,210
Now let me actually create another variable.

147
00:09:01,210 --> 00:09:03,850
So the data type of My value is boolean.

148
00:09:04,110 --> 00:09:04,630
OK.

149
00:09:04,720 --> 00:09:08,980
And now you want to actually give a name to my variable for example.

150
00:09:09,300 --> 00:09:13,100
Chan by car.

151
00:09:13,570 --> 00:09:14,360
OK.

152
00:09:14,830 --> 00:09:17,090
And then you want to assign a value to my value.

153
00:09:17,110 --> 00:09:18,640
For example false.

154
00:09:19,300 --> 00:09:23,340
And then at the end of my statement I need to put in a semicolon OK.

155
00:09:23,470 --> 00:09:32,770
So now I want to output the value of this invaluable to the consulate system that out that print line

156
00:09:33,500 --> 00:09:37,830
and then inside the apprentice's I just need to refer to the name of my variable.

157
00:09:37,830 --> 00:09:39,890
Can by car.

158
00:09:40,990 --> 00:09:41,490
OK.

159
00:09:41,740 --> 00:09:44,890
And then at the end of my statement I need to put in a semicolon.

160
00:09:44,890 --> 00:09:45,290
OK.

161
00:09:45,430 --> 00:09:45,730
OK.

162
00:09:45,730 --> 00:09:47,780
Inside it up and codes just type in here.

163
00:09:47,820 --> 00:10:00,410
This is the value of the can by card value.

