Skip to content

Commit 634a5a4

Browse files
authored
Create README.md
Added a bonus lesson on comments in Java
1 parent 217e8ba commit 634a5a4

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

Diff for: README.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
1-
# LearningToProgramInJava
1+
# LearningToProgramInJava
2+
In this repository are the sample programs from the first video in the Learning To Program In Java.
3+
4+
# Bonus Segment - Comments
5+
6+
In these samples you will find comments. Ideally you will create code with meaningful names for identifiers that will allow another developer to understand what you are doing. Comments allow you to add notes to your code. These notes should describe what the code is doing if it is not obvious. You may know exactly what you are coding today but will you remember your intentions in 6 months from now?
7+
8+
There are three ways to add comments to code:
9+
10+
# //
11+
12+
A single line comment in Java begins with the double forward slash (//) and ends when the line ends. This is useful for adding comments to a single line
13+
14+
# <pre>/* */</pre>
15+
16+
This syntax allows you to enclose multi-line comments. It can also be used to comment out code that you do not wish to compile but are not yet ready to delete. It is usually a good idea to comment out code before you delete it if the original code is better than its replacement. You cannot nest this comment in another. You can nest the single line comment.
17+
18+
/* Comment /* nested comment */ comment */ is not allowed
19+
20+
/* comment //single line comment more comment */ is allowed
21+
22+
# <pre>/** */</pre>
23+
24+
This syntax that begins with a forward slash star star is used to create comment blocks in front of classes and methods. These comment blocks are picked up by a tool in Java called JavaDocs that creates html documentation pages from your code.

0 commit comments

Comments
 (0)