User Program Communication

Commenting in Java

Commenting is used to write text within the code that is ignored by the compiler.

// A single line text comment
/* A block comment, 
containing multiple lines
* @param
* @return 
Documentation */


Can be used for documentation, code descriptions, resource inclusion, readability, debugging, and any other note that the programmer would like to include.

The documentation comment is the same as the single line and block comments, except the JDK Javadoc tool uses this type of comment when creating automatically generated documentation. Parameter and return descriptions can be provided here.

For the // comment, the compiler will ignore everything from // to the end of the line.
For the /* */ and /** **/ comments, the compiler will ignore anything from /* to */, or /** to **/.

/** Author: SyntaxDB **/ 
System.out.println("I think I am cool."); //Outputs the string 'I think I am cool!' 
The code below outputs the string:
'Because I am!'
System.out.println("Because I am!");

See Also

Oracle - Java Coding Conventions

Add to Slack

< User Input   |   Read from Text File >

© 2019 SyntaxDB. All Rights Reserved.