WEBVTT

00:00.230 --> 00:01.600
Welcome back.

00:01.610 --> 00:09.770
Before we start typing any Java codes, I should mention a very important topic, which is the comments.

00:09.800 --> 00:16.370
In Java, comments are used to write notes or explanations within your code.

00:16.400 --> 00:25.220
Comments are not executed as part of the program, but are instead intended for developers to read and

00:25.220 --> 00:27.590
understand the code better.

00:27.740 --> 00:34.610
In the previous lesson we wrote this line of code, but if we run the program, this line will not be

00:34.610 --> 00:42.140
executed because it's a type of comments and it's single line comments because start with these two

00:42.140 --> 00:44.030
forward slashes.

00:44.060 --> 00:52.010
Comments in general, help improve code readability and make it easier for others, including yourself,

00:52.010 --> 00:55.310
to understand your code later on.

00:55.340 --> 01:01.320
There are two types of comments in Java, the single line comments and multi-line line comments.

01:01.350 --> 01:02.760
The single line comment.

01:02.760 --> 01:04.140
This is like this.

01:05.160 --> 01:15.120
To add a single line comment, you can use two forward slashes at the beginning of the line and anything

01:15.120 --> 01:21.780
written after the slashes are going to be ignored by the compiler.

01:22.350 --> 01:23.870
Here's an example.

01:23.880 --> 01:26.910
For example, this line right here, your code.

01:26.910 --> 01:30.330
If we run the program, it will not be executed.

01:31.890 --> 01:34.620
The multi line comments.

01:34.650 --> 01:42.900
Multi line comments also known as block comments are used when you want to write comments that span

01:42.900 --> 01:45.350
multiple multiple lines.

01:45.360 --> 01:53.640
To create a multi-line comment, you enclose the comment between the forward slash and the forward slash

01:53.640 --> 01:55.740
with the asterisk.

01:55.740 --> 02:04.140
So for example, here we start with the forward slash and this asterisk and another asterisk and this

02:04.140 --> 02:06.660
forward slash.

02:06.780 --> 02:13.740
Then between these two lines, I'll include the comments, the multi-line comments.

02:14.100 --> 02:17.940
Hello, my friends.

02:19.670 --> 02:29.060
All these lines are not being executed.

02:30.340 --> 02:33.520
They are ignored.

02:34.570 --> 02:34.990
Okay.

02:35.260 --> 02:41.740
This is the multi-line comment and this is the single line comments.

02:41.740 --> 02:52.630
So comments will help you to explain complex logic documenting code functionality, providing instructions

02:52.630 --> 02:58.900
to other developers or temporarily disabling portions of the code for testing purposes.

02:58.900 --> 03:04.390
Later on, we'll see these comments a lot in our projects.
