-
-
Lecture1.1
-
Lecture1.2
-
Lecture1.3
-
Lecture1.4
-
Lecture1.5
-
Lecture1.6
-
Lecture1.7
-
Lecture1.8
-
Lecture1.9
-
Lecture1.10
-
Lecture1.11
-
Lecture1.12
-
Lecture1.13
-
Lecture1.14
-
Java Comments
Java comments are either explanations of the source code or descriptions of classes, interfaces, methods, and fields. There are three types of comments used in Java. These are:
1. Single Line Comments:
To add a comment in one line using two slash characters i.e. //text
.Starting with the //
text ignore by compiler.
Example:
[php]
//This is single line comment.
[/php]
2. Multi Line Comments:
To add a comment in multi line start using slash and asterisk characters and end using asterisk and slash i.e. /*text*/
.
Example:
[php]
/*This is multi line comment.
Welcome to Tech2Our. */
[/php]
3. Documentation Comment.
The JDK javadoc tool uses doc comments when preparing automatically generated documentation.
Example:
[php]
/**Get the Student name and roll number.
*@ return this Student’ name
*@ Mobile Number should be ten digit
*/[/php]
Prev
C++ vs Java
Next
Java Operators