1
00:00:00,290 --> 00:00:06,600
Hire everyone in the theater you will I'm going to talk about comments variabilis and primitive data

2
00:00:06,600 --> 00:00:07,220
types.

3
00:00:07,410 --> 00:00:10,490
So first I you to create our Java project.

4
00:00:10,710 --> 00:00:17,660
So first we need to click can find new and click on Java project for the project name.

5
00:00:17,660 --> 00:00:26,920
Just type in variables and I choose the default location for saving my project here and click on finish.

6
00:00:27,270 --> 00:00:29,910
And as you can see here my project is created.

7
00:00:30,070 --> 00:00:30,660
OK.

8
00:00:30,750 --> 00:00:34,060
Now we need to create a Java class for our project.

9
00:00:34,230 --> 00:00:36,470
So first click on this as RC for that.

10
00:00:36,480 --> 00:00:43,690
Or you can click on this variable's project and then click on find Neil and click on class.

11
00:00:44,100 --> 00:00:44,640
OK.

12
00:00:44,700 --> 00:00:48,120
Now we need to actually enter our last name here.

13
00:00:48,300 --> 00:00:53,790
So for the class and just type in variable and make sure that your class name starts with a capital

14
00:00:53,790 --> 00:00:54,610
letter.

15
00:00:54,750 --> 00:01:00,220
Because this is a convention in Java that all your classes should start with a capital letter.

16
00:01:00,280 --> 00:01:02,030
OK so this is really important.

17
00:01:02,290 --> 00:01:08,620
And here for the first time I really don't actually enter a package name for our package.

18
00:01:08,820 --> 00:01:15,610
And as I said earlier in this section that package is just a way to actually organize our Java files.

19
00:01:15,630 --> 00:01:16,120
OK.

20
00:01:16,290 --> 00:01:23,870
So for the package name we just need to actually type in a reverse domain so calm that Mortaza.

21
00:01:24,180 --> 00:01:30,230
OK that's an idea and we just need to actually enter our project name variables.

22
00:01:30,240 --> 00:01:31,840
OK.

23
00:01:32,010 --> 00:01:38,190
And this is a convention in Java that you should actually name your package names.

24
00:01:38,190 --> 00:01:39,190
OK.

25
00:01:39,630 --> 00:01:40,490
Like this.

26
00:01:40,580 --> 00:01:41,250
OK.

27
00:01:41,290 --> 00:01:42,460
A reverse domain.

28
00:01:42,460 --> 00:01:49,790
And at the end just enter your project name and for the modifiers just check it is a public modifier.

29
00:01:49,860 --> 00:01:54,630
And here check this checkbox here that says public is static void main method.

30
00:01:54,630 --> 00:02:00,150
This is a starting point for actually running our Java codes and click on finish.

31
00:02:00,810 --> 00:02:06,240
And here as you can see our class is created and here is our package name.

32
00:02:06,420 --> 00:02:11,290
OK this is our package name as you can see here and in our project directory.

33
00:02:11,670 --> 00:02:18,240
When you open the source folder inside the source folder there is a package and this is the package

34
00:02:18,240 --> 00:02:19,810
name as you can see here.

35
00:02:20,320 --> 00:02:21,790
And here is the same package.

36
00:02:21,830 --> 00:02:22,540
OK.

37
00:02:22,800 --> 00:02:28,380
So the package name of the class is established by the package statement.

38
00:02:28,380 --> 00:02:30,770
Ok this is our package statement.

39
00:02:30,860 --> 00:02:31,570
OK.

40
00:02:31,890 --> 00:02:37,610
Which must be the first line of a Java program when it is used.

41
00:02:37,680 --> 00:02:40,810
OK so that's it for packages.

42
00:02:41,050 --> 00:02:41,520
OK.

43
00:02:41,550 --> 00:02:43,620
Now I'm going to ask you about comments.

44
00:02:43,620 --> 00:02:47,170
So as you can see here are this line of text here is a comment.

45
00:02:47,190 --> 00:02:47,800
OK.

46
00:02:48,060 --> 00:02:55,500
I can create my own comments to for example and putting our two forward slashes and then I can actually

47
00:02:55,510 --> 00:02:56,160
type.

48
00:02:56,260 --> 00:03:00,750
I just enter what ever it takes that I want.

49
00:03:01,500 --> 00:03:06,000
Ok what ever text that I want.

50
00:03:06,170 --> 00:03:09,570
OK so what are comments.

51
00:03:09,600 --> 00:03:17,880
First let me point out that comments are one of the most effective ways to improve our programs readability.

52
00:03:17,910 --> 00:03:18,610
OK.

53
00:03:18,870 --> 00:03:25,670
These are text included in a program that explains what's going on in the code.

54
00:03:25,800 --> 00:03:26,580
OK.

55
00:03:26,580 --> 00:03:33,270
And the Java compiler is going to actually completely ignore these lines of text.

56
00:03:33,270 --> 00:03:34,860
Ok these comments.

57
00:03:34,890 --> 00:03:36,450
So what is a compiler.

58
00:03:36,690 --> 00:03:45,870
As I said in the previous section or compiler is a special software compiler is exclusive software that

59
00:03:45,870 --> 00:03:53,680
actually convert your Java code into a language that the machine can understand.

60
00:03:53,920 --> 00:04:00,880
OK so now I'm going to show you some real examples about using comments in your programs.

61
00:04:00,900 --> 00:04:07,050
So first of all I want to show you how to actually make this editor area wider in order to write our

62
00:04:07,050 --> 00:04:07,830
codes better.

63
00:04:07,860 --> 00:04:08,420
OK.

64
00:04:08,670 --> 00:04:15,770
So in order to make the is actually the editor area wider you just need to double click on this variable

65
00:04:15,770 --> 00:04:21,740
to job hop here which as you can see this little area is much wider now.

66
00:04:22,020 --> 00:04:26,780
And in order to go back to the default screen just DoubleClick is valuable over here.

67
00:04:26,940 --> 00:04:29,330
And as you can see here this is the default screen.

68
00:04:29,330 --> 00:04:29,900
OK.

69
00:04:30,240 --> 00:04:34,830
So now I want to actually out with Dave or hello to the council.

70
00:04:35,010 --> 00:04:42,210
So let's see what happens system that out princeling and inside the Apprentice it's just I just put

71
00:04:42,210 --> 00:04:46,820
in a two level codes and just type in Hello

72
00:04:49,440 --> 00:04:57,370
cake and at the end just up with a semi-colon at the end of your statement here I want to actually use

73
00:04:57,370 --> 00:05:01,630
a comment that explains what this code here is doing.

74
00:05:01,810 --> 00:05:05,190
So let's see what comments are.

75
00:05:05,530 --> 00:05:13,700
As you can see I am the one to actually I am out putting forth

76
00:05:16,430 --> 00:05:19,450
hello to the console.

77
00:05:22,720 --> 00:05:30,400
So here as you can see this comment here is just explaining what this code what this statement here

78
00:05:30,400 --> 00:05:31,200
is doing.

79
00:05:31,390 --> 00:05:31,870
OK.

80
00:05:31,990 --> 00:05:35,930
And the compiler completely ignores these comments.

81
00:05:35,980 --> 00:05:36,900
OK.

82
00:05:37,240 --> 00:05:41,340
So first let me actually run this program and let's see what happens.

83
00:05:41,530 --> 00:05:48,490
So as you can see the vault Halo is out with the console area and these comments are completely ignored

84
00:05:48,520 --> 00:05:49,550
by the compiler.

85
00:05:49,750 --> 00:05:50,250
OK.

86
00:05:50,440 --> 00:05:56,630
So it's really good to actually get into the habit of writing comments in your programs.

87
00:05:56,650 --> 00:06:02,980
It's going to make your programs more meaningful for yourself or other programs that may actually look

88
00:06:03,070 --> 00:06:04,750
at your codes in the future.

89
00:06:04,890 --> 00:06:05,530
OK.

90
00:06:05,800 --> 00:06:09,390
So always use comments in your programs.

91
00:06:09,580 --> 00:06:13,080
And we have three kinds of comments in Java.

92
00:06:13,360 --> 00:06:16,870
So first of all we have got our single line comment.

93
00:06:16,900 --> 00:06:21,250
So as you can see here these comments are called single line comments.

94
00:06:21,250 --> 00:06:21,860
OK.

95
00:06:21,910 --> 00:06:27,100
So in order to create a single line comment just putting two forward slashes and typing your text.

96
00:06:27,100 --> 00:06:32,690
For example this is called This is called a single line comment.

97
00:06:35,560 --> 00:06:41,720
And everything from the slushes forward as you can see here is called the comment and it's going to

98
00:06:41,720 --> 00:06:44,290
be completely ignored by the compiler.

99
00:06:44,300 --> 00:06:44,870
OK.

100
00:06:45,000 --> 00:06:48,050
Another type of comment is a multi-line comment.

101
00:06:48,050 --> 00:06:54,350
So for example if you want to create a multi-line comment in my program I just need to start my multi-line

102
00:06:54,350 --> 00:07:03,320
comment with a forward slash and multiply operator and that I need to actually end my multi-line comment

103
00:07:03,560 --> 00:07:07,080
with the multiply operator and a forward slash.

104
00:07:07,190 --> 00:07:08,540
So this is very important.

105
00:07:08,660 --> 00:07:14,480
You need to actually start your model and comment with a forward slash and then multiply operator or

106
00:07:14,480 --> 00:07:16,560
the star symbol as you can see here.

107
00:07:16,940 --> 00:07:20,470
And then we need to end our multi-line comment.

108
00:07:20,730 --> 00:07:28,580
Multiply operator and forward slash So everything between these two delimiters is considered a comment.

109
00:07:28,670 --> 00:07:34,670
So for example if I just press on the Enter key on my keyboard as you can see here I can actually put

110
00:07:34,670 --> 00:07:37,760
in my text here so I can just type in here.

111
00:07:37,760 --> 00:07:45,240
This is called Amante line comment as you can see here.

112
00:07:45,440 --> 00:07:45,890
OK.

113
00:07:47,590 --> 00:07:55,780
So this text this line of this line of text here is completely ignored by the compiler or the compiler

114
00:07:55,780 --> 00:08:00,920
is going to ignore everything that we hide between these two delimiters.

115
00:08:00,940 --> 00:08:01,650
OK.

116
00:08:01,690 --> 00:08:05,080
The last type of comments is called Javadoc comments.

117
00:08:05,090 --> 00:08:05,620
OK.

118
00:08:05,770 --> 00:08:12,910
For example if I want to create a job with comments in my program first I just need to begin my Java

119
00:08:13,180 --> 00:08:20,440
comment with a forward slash and to multiply operators and then I need to end my job what I comment

120
00:08:20,840 --> 00:08:24,320
with the multiply operator and our forward slash.

121
00:08:24,550 --> 00:08:31,240
So as you can see here everything between these two delimiters is considered a Java like comment.

122
00:08:31,240 --> 00:08:37,720
OK so for example if I again present Enter key on my keyboard as you can see here I can type in here

123
00:08:37,720 --> 00:08:38,620
anything that I want.

124
00:08:38,620 --> 00:08:40,650
For example I can type in here.

125
00:08:40,660 --> 00:08:49,790
This is called Java that comment Java dodge comment.

126
00:08:50,580 --> 00:08:51,560
OK.

127
00:08:51,780 --> 00:08:59,820
But we don't use actually Obstat comments in our programs and Jodo comments are designed to be read

128
00:08:59,880 --> 00:09:04,380
by utilities such as job attach a command line tool.

129
00:09:04,500 --> 00:09:07,180
That's part of Java Development Kit JDK.

130
00:09:07,270 --> 00:09:07,880
OK.

131
00:09:08,100 --> 00:09:15,550
This tool uses official comments to create a set of web pages that document that the functionality of

132
00:09:15,620 --> 00:09:17,280
of a Java class.

133
00:09:17,280 --> 00:09:17,860
OK.

134
00:09:18,240 --> 00:09:20,250
So we don't actually use this.

135
00:09:20,450 --> 00:09:23,790
This Java comment a lot in our programs.

136
00:09:24,000 --> 00:09:24,310
OK.

137
00:09:24,330 --> 00:09:29,390
But later I want to show you more about comments in our programs for example.

138
00:09:29,670 --> 00:09:38,280
If I don't want to actually execute this line of code here for example if I run my program now you can

139
00:09:38,280 --> 00:09:44,160
see that it's going to show me the hello text here but if I don't want to actually execute this line

140
00:09:44,160 --> 00:09:47,550
of code I can easily comment out this line of code.

141
00:09:47,900 --> 00:09:48,560
OK.

142
00:09:48,870 --> 00:09:55,380
Now you can see that if I run my program it's going to show me nothing because this this statement is

143
00:09:55,380 --> 00:09:56,680
now commented out.

144
00:09:56,700 --> 00:09:57,360
OK.

