Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Commenting Conventions [closed]

Tags:

Which method of commenting is most widely accepted or does it really matter?

I have been using

/**    * (Method description)  * @param  * @return  * etc  */ 

However I have read of:

Precondition: Postcondition: 

Is there a more 'professional' way of commenting?

like image 281
Garee Avatar asked Aug 29 '10 02:08

Garee


People also ask

How do you close comments in Java?

Java Multi-line Comments Multi-line comments start with /* and ends with */ . Any text between /* and */ will be ignored by Java.

How do you comment properly in Java?

Java programs can have two kinds of comments: implementation comments and documentation comments. Implementation comments are those found in C++, which are delimited by /*... */, and //. Documentation comments (known as "doc comments") are Java-only, and are delimited by /**...

What are the three types of comments in Java?

In Java there are three types of comments:Single-line comments. Multi-line comments. Documentation comments.

What is Java code conventions?

The Java code conventions are defined by Oracle in the coding conventions document. In short, these conventions ask the user to use camel case when defining classes, methods, or variables. Classes start with a capital letter and should be nouns, like CalendarDialogView .


1 Answers

Here are the Java coding conventions for comments recommended by Oracle:

  • http://www.oracle.com/technetwork/java/codeconventions-141999.html#385

Here are Google's recommendations for their Android platform:

  • https://source.android.com/source/code-style.html#use-javadoc-standard-comments

For more detailed information on style and conventions for Javadoc, see here:

  • How to Write Doc Comments for the Javadoc Tool
like image 176
Gunslinger47 Avatar answered Sep 18 '22 02:09

Gunslinger47