1
00:00:00,450 --> 00:00:08,370
So as you can see here in this line of code I just declared this valuable and here I referred to the

2
00:00:08,370 --> 00:00:12,900
name of my valuable and I assigned a value to my value.

3
00:00:13,050 --> 00:00:16,700
And here I referred to this now free variable.

4
00:00:16,830 --> 00:00:20,430
And I just create the value of this variable.

5
00:00:20,520 --> 00:00:21,200
OK.

6
00:00:21,510 --> 00:00:29,790
But if I for example want to refer to this are now very valuable here as you can see here now free.

7
00:00:29,830 --> 00:00:30,250
OK.

8
00:00:30,390 --> 00:00:32,360
As you can see it's not showing me an error.

9
00:00:32,400 --> 00:00:33,780
So let's see what's this error.

10
00:00:33,990 --> 00:00:38,040
Now free cannot be resolved as you can see here.

11
00:00:38,280 --> 00:00:41,180
It's not recognizing there are no free variable.

12
00:00:41,420 --> 00:00:42,010
OK.

13
00:00:42,090 --> 00:00:46,510
Because I declared this now free variable in line 52.

14
00:00:46,560 --> 00:00:47,030
OK.

15
00:00:47,130 --> 00:00:51,450
And I am referring to this not everybody but in line 50.

16
00:00:51,570 --> 00:00:58,010
So you must actually refer to a variable that was created before.

17
00:00:58,140 --> 00:00:58,810
OK.

18
00:00:59,070 --> 00:01:05,440
For example if I created this variable here I just can't refer to this the name of this variable here.

19
00:01:05,580 --> 00:01:08,410
All the lines after the creation of this variable.

20
00:01:08,430 --> 00:01:09,080
OK.

21
00:01:09,330 --> 00:01:13,940
You can't refer to a variable before the creation of that variable.

22
00:01:14,010 --> 00:01:18,380
Ok this is very important and I'll touch more about this concept later.

23
00:01:18,800 --> 00:01:19,550
OK.

24
00:01:19,770 --> 00:01:23,770
Now I'm going to talk about naming variables in Java.

25
00:01:23,880 --> 00:01:24,500
OK.

26
00:01:24,720 --> 00:01:31,400
So first let me comment about this line of code because I don't want to execute this statement any more.

27
00:01:31,410 --> 00:01:40,020
First of all let me point out that in Java all variable names must start with a letter and underscore

28
00:01:40,020 --> 00:01:42,000
character at the other side.

29
00:01:41,990 --> 00:01:42,610
OK.

30
00:01:42,870 --> 00:01:49,440
Variable names can not start with a number you cannot start your variable names with a number.

31
00:01:49,440 --> 00:01:56,550
This is a very important point in name and your valuables after the first character variable names can

32
00:01:56,550 --> 00:02:02,450
include any combination of letters numbers underscore characters or Dollar Signs.

33
00:02:02,530 --> 00:02:10,560
OK now let me show you some real examples about naming variables in Java to make this concept more clear

34
00:02:10,560 --> 00:02:11,070
for you.

35
00:02:11,070 --> 00:02:18,400
OK so as you can see here I'm going to declare a variable here so the data type of my variable is int.

36
00:02:18,420 --> 00:02:19,950
This ain't data type.

37
00:02:19,950 --> 00:02:25,530
Here means that my variable holds an integer or a whole number.

38
00:02:25,550 --> 00:02:28,860
OK so now I'm going to actually name my value.

39
00:02:29,130 --> 00:02:38,520
So as I said earlier variable names in Java must start with the letter and underscore character or a

40
00:02:38,520 --> 00:02:39,220
dollar sign.

41
00:02:39,270 --> 00:02:43,740
OK so now I am going to actually start my variable name with the letter.

42
00:02:44,070 --> 00:02:47,570
So for example a valuable.

43
00:02:48,030 --> 00:02:53,350
Ok now I'm going to assign a value to my variable for example not per number 30.

44
00:02:53,570 --> 00:03:00,150
OK so as you can see here I start at my variable name with a lowercase letter.

45
00:03:00,330 --> 00:03:07,470
As you can see so this is a convention in Java that you should actually start your variable names with

46
00:03:07,470 --> 00:03:08,620
a lowercase letter.

47
00:03:08,670 --> 00:03:15,420
OK you can actually start your variable name with the uppercase letter as you can see here but it's

48
00:03:15,420 --> 00:03:19,900
better to actually declare your variable names with a lower case letter.

49
00:03:19,930 --> 00:03:26,680
OK because this is a convention in Java that you should always start your variable names with a lowercase

50
00:03:26,690 --> 00:03:28,150
Slidder OK.

51
00:03:28,440 --> 00:03:35,340
And as you can see here my variable name here starts with a lowercase letter.

52
00:03:35,580 --> 00:03:40,220
So the first letter of the variable name is lowercase.

53
00:03:40,230 --> 00:03:40,930
OK.

54
00:03:41,370 --> 00:03:47,870
And each successive forth in the variable name begins with a capital letter.

55
00:03:47,880 --> 00:03:55,560
So as you can see here this valuable vote here starts with a capital V OK and if I want to for example

56
00:03:56,010 --> 00:03:57,890
add another vote here.

57
00:03:58,110 --> 00:04:00,950
For example a variable name.

58
00:04:01,360 --> 00:04:03,790
OK so let's see what happens.

59
00:04:04,380 --> 00:04:13,410
As you can see I started this vort this and then vote here with a capital N. and all other letters are

60
00:04:13,560 --> 00:04:14,960
lowercase.

61
00:04:14,970 --> 00:04:21,760
So to recap as you can see here the first letter of the variable name is lowercase.

62
00:04:22,050 --> 00:04:24,770
So this a letter is lowercase OK.

63
00:04:25,320 --> 00:04:32,310
And each successive board in the variable name begins with a capital letter.

64
00:04:32,360 --> 00:04:37,360
It is valuable word and this name vord begins with a capital letter.

65
00:04:37,380 --> 00:04:43,130
As you can see here and all other letters are lower case.

66
00:04:43,140 --> 00:04:45,240
So let me show you another example.

67
00:04:45,610 --> 00:04:51,270
Again the data type is int and the variable name would be another

68
00:04:54,590 --> 00:04:58,380
is declared here.

69
00:04:58,940 --> 00:05:00,130
As you can see here.

70
00:05:00,230 --> 00:05:02,840
This variable name is a very long name.

71
00:05:03,020 --> 00:05:08,730
OK it is acceptable in Java that you actually write Longueval names.

72
00:05:08,750 --> 00:05:10,210
If it is it is OK.

73
00:05:10,340 --> 00:05:15,400
There is no problem about it and that I can't assign a value to my variable.

74
00:05:15,500 --> 00:05:26,570
For example 23 and here are the first letter of my variable name begins with a lowercase letter and

75
00:05:26,690 --> 00:05:32,820
each successive vote in the variable name begins with a capital letter.

76
00:05:32,840 --> 00:05:38,020
OK this variable is declared here as you can see these.

77
00:05:38,600 --> 00:05:41,980
Start with a capital letter OK.

78
00:05:42,170 --> 00:05:45,530
And all other letters are lowercase.

79
00:05:45,530 --> 00:05:51,650
OK this is a convention in Java that you should always actually name your valuables this way.

80
00:05:51,720 --> 00:06:01,940
OK and let me show you another examples this time again the data type would be int here.

81
00:06:01,940 --> 00:06:06,680
I'm going to start my variable name with the underscore character.

82
00:06:07,190 --> 00:06:11,420
And again I need to actually start my other votes.

83
00:06:11,450 --> 00:06:15,710
Each successive vote in the variable name with a capital letter.

84
00:06:15,830 --> 00:06:19,040
Ok for example are there

85
00:06:23,100 --> 00:06:26,350
and again I can't assign a value to my value.

86
00:06:26,980 --> 00:06:32,190
It is OK to actually start your variable names with the underscore character.

87
00:06:32,740 --> 00:06:40,050
And again I'm going to actually show you another example this time the data type is again integer Int.

88
00:06:40,240 --> 00:06:44,500
And does that mean we're going to start my variable name with a dollar sign.

89
00:06:44,590 --> 00:06:45,660
OK.

90
00:06:46,090 --> 00:06:52,100
I can actually type in here other words for example dollar sign value.

91
00:06:54,880 --> 00:06:58,120
And again I can assign values to my variable.

92
00:06:58,150 --> 00:06:59,470
For example for free.

93
00:06:59,530 --> 00:07:00,170
OK.

94
00:07:00,430 --> 00:07:05,030
So as you can see here this variable name here starts with a dollar sign.

95
00:07:05,200 --> 00:07:11,130
And each successive word in the value of a name begins with the uppercase letter.

96
00:07:11,200 --> 00:07:11,950
OK.

97
00:07:12,340 --> 00:07:19,360
So this is how you actually declare actually your variable names in Java and you should always as I

98
00:07:19,360 --> 00:07:28,180
said before all your variable names must start with the letter and underscore character or a dollar

99
00:07:28,170 --> 00:07:28,500
sign.

100
00:07:28,540 --> 00:07:28,780
OK.

101
00:07:28,780 --> 00:07:33,150
You can't actually start your variable name with the number.

102
00:07:33,280 --> 00:07:36,210
So let me show you what's what's the problem with that.

103
00:07:36,290 --> 00:07:43,000
With actually naming your valuables like that as you can see the data type is int and I'm going to actually

104
00:07:43,000 --> 00:07:46,430
declare my variable name here.

105
00:07:46,630 --> 00:07:52,770
For example 21 variable name J.

106
00:07:53,050 --> 00:07:59,590
And then I can assign a value to my variable and then I just need to put a semicolon at the end of her

107
00:07:59,590 --> 00:08:00,610
statement.

108
00:08:00,610 --> 00:08:08,830
So let's actually run our project and here as you can see it says errors exist in required projects.

109
00:08:08,980 --> 00:08:10,410
This project variables.

110
00:08:10,600 --> 00:08:13,610
So we can't actually launch our project now.

111
00:08:13,660 --> 00:08:14,660
There must be an error.

112
00:08:14,680 --> 00:08:15,260
OK.

113
00:08:15,460 --> 00:08:24,040
So as you can see here if I hover over my mouse pointer over the error area here as you can see it says

114
00:08:24,160 --> 00:08:27,240
syntax error on token 21.

115
00:08:27,280 --> 00:08:28,640
Delete this token.

116
00:08:29,080 --> 00:08:36,380
So as you can see here it asks us to actually delete this number 21 at the start of our variable name.

117
00:08:36,490 --> 00:08:44,650
So now let's just actually delete this number 21 at the start of our variable name and let's see what

118
00:08:44,650 --> 00:08:45,800
happens.

119
00:08:46,360 --> 00:08:49,680
And as you can see here now the error is gone.

120
00:08:49,990 --> 00:08:53,160
And now I can actually run my project.

121
00:08:53,170 --> 00:08:53,790
OK.

122
00:08:54,100 --> 00:09:01,330
So if I for example want to output the value of this variable name to the canso I can just type in system

123
00:09:02,560 --> 00:09:05,110
that out that print line.

124
00:09:05,710 --> 00:09:07,430
And that inside the parenthesis.

125
00:09:07,510 --> 00:09:11,580
I just need to refer to this variable name here.

126
00:09:12,110 --> 00:09:12,950
Variable name

127
00:09:16,950 --> 00:09:21,590
and that I just need to put a semi-colon at the end of our Actually statement.

128
00:09:21,600 --> 00:09:22,350
OK.

129
00:09:23,010 --> 00:09:32,600
So here I just need to run my project as you can see it's now actually showing us the number 42 on the

130
00:09:32,610 --> 00:09:33,920
console here.

131
00:09:34,230 --> 00:09:38,160
So the number 42 is the value of this variable name.

132
00:09:38,330 --> 00:09:39,120
OK.

133
00:09:39,750 --> 00:09:42,020
So that's it for variables.

134
00:09:42,030 --> 00:09:45,530
I think that's enough for valuables.

