Just as it is used (#) to allow the Perl interpreter to know that a line of code is a comment, you can specify the comments in Java
In fact, there are several ways to denote comments into Java
For one line of comments, you can use the “/ /” For example, consider the following code :
/ / Initialize variables …
int age = 28; / / Declare and initialize age
To enter comments from several lines, using the symbols “/ *” and “* /”, as seen in the example
/ *
This is a sample class that is used to demonstratethe use of multi – Online reviews.
It was written by Carlos Jordan for Learning Java
* /
/ * Set an Example class with a single
Main (), with the method to print
“Hello cyberspace!” to the standard output .
*/
public class Example
(Public static void main (String [] args)
(System.out.println ( “Hello cyberspace !”);
)
) < >
Finally, if you are writing reviews that should be included as part of a javadoc, you must use the “/**” “* /” combination as in the following example :
/ *
This is a kind of sample that is used to demonstratethe use of multi-line comments.
It was written by Carlos Jordan to learn Java. These comments do not appear in the documentation of java
* /
/ **
Example define a class with a single
main () method to print
“Hello cyberspace!” to the standard output.
This commentary appears in the javadoc.
* /
public class Example
(
public static void main (String [] args)
(
System.out.println ( “Hello cyberspace !”);
)
)