05 06

Writing good comments in java

writing good comments in java java source files is enclosed in start and end syntax like so: /** and */. Each comment within these is prefaced with a *.

Place these comments directly above the method, class, constructor or any other Java element that you want to document. For example:

// myClass.java /** * Make this a summary sentence describing your class. * Here's another line. */ public class ​myClass { ... }

Javadoc incorporates various tags that control how the documentation is generated. For example, the @param tag defines parameters to a method:

/** main method * @param args String[] */​ public static void main(String[] args) ​{ ​ System.out.println("Hello World!");​ }

Many other tags are available in Javadoc, and it also supports HTML tags to help control the output.

See your Java documentation for more detail.

great - Javadoc for Stack. writing Technical tips java -

writing good comments in java

Comments

  1. Tusewedewez

    Only because you never read the comments. ( Good for you, dude! )

  2. Quboruzucogila

    There is a lot of comments that are like You"re wrong, it"s good! They don"t help to the conversation, but they get the likes.

  3. Zaguyuwotin

    That"s good. Was kind of expecting more comments like: Wtf! Sonic Forces will be the bestest objective game evah! So stfu you idiot!

  4. Nojeheqecef

    There is no real good reason for to be making these comments. Desperate for attention with away I guess.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>