ushowardlink
Traffic Strategist
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
300 XP
Introduction:
Welcome to a tutorial on the use of comments within Java.
What are comments?
When are comments used?
What is the format for a comment?
To submit a comment within Java, there are two ways to do this, the first one is a simple, one line comment which begins with two forward slashes ("//"). The second way allows multiple comment lines in a row which start with an asterix ("*") and is initialised by "/**" and terminated with "*/". Examples below.
Examples:
Here is an example of both types of comment...
2 This line is not a comment and so is ran by Java.
4 This line is not a comment and so is ran by Java.
As you can see, the three lines in the comment types are not ran by Java.
Finished!
Book traversal links for Comments
Welcome to a tutorial on the use of comments within Java.
What are comments?
When are comments used?
What is the format for a comment?
To submit a comment within Java, there are two ways to do this, the first one is a simple, one line comment which begins with two forward slashes ("//"). The second way allows multiple comment lines in a row which start with an asterix ("*") and is initialised by "/**" and terminated with "*/". Examples below.
Examples:
Here is an example of both types of comment...
- //System.out.println("1 This line is a comment and so is not ran by Java.");
- System
.out
.println
(
"2 This line is not a comment and so is ran by Java."
)
;
- /**
- * System.out.println("3 This line is a comment and so is not ran by Java.");
- * System.out.println("3.5 This line is a comment and so is not ran by Java.");
- */
- System
.out
.println
(
"4 This line is not a comment and so is ran by Java."
)
;
2 This line is not a comment and so is ran by Java.
4 This line is not a comment and so is ran by Java.
As you can see, the three lines in the comment types are not ran by Java.
Finished!
Book traversal links for Comments
- ‹ Arrays
- Up
- Date and Time ›