Game Development Reference
In-Depth Information
forward slash next to an asterisk to start the comment and the reverse of that, an as-
terisk next to a single forward slash , to end the multi-line comment.
As you can see in the InvinciBagel.java code editing tab in NetBeans 8.0, just as I
lined up the single-line comments to look pretty (cool) and organized, so too the Java
convention in block commenting is to line up the asterisks, with one as the beginning
comment delimiter and one as the ending comment delimiter.
Definition A “ convention ” in Java programming is the way that most, if not all,
Java programmers will implement a Java construct. In this case, this is the way that the
Java code block commenting is styled .
There is a third type of comment, called a Javadoc comment, which you will not
be using in your Java 8 game development, as your code is intended to be used to cre-
ate a game, and not to be distributed to the public. If you were going to write a Java
game engine for use by others to create games, that is when you would use Javadoc
comments to add documentation to your Java 8 game engine. A Javadoc comment can
be used by the javadoc.exe tool in the JDK to generate HTML documentation for the
Java class containing Javadoc comments, based on the text content that you put inside
the Javadoc comment.
A Javadoc comment is similar to a multiline comment, but it uses instead two aster-
isks to create the opening Javadoc comment delimiter, as shown here:
/** This is an example of a Java Documentation (Javadoc)
type of Java code comment.
This is a type of comment which will automatically
generate Java documentation!
*/
If you wanted to insert a comment right in the middle of your Java statement or
programming structure (which you should never do as a professional Java program-
mer), use the multiline comment format, like so:
i mport /* This line of code imports the Stage class
*/ javafx.stage.Stage;
This will not generate any errors, but would confuse the readers of this code, so do
not comment your code in this way. The following single line comment way of com-
Search WWH ::




Custom Search