Ofek Ron
Ofek Ron

Reputation: 8578

How to document my method in Java like Java docs?

I want that when i mouse over a method i would be able to see my documentation of what the method does like when i put the mouse over Java's method I know that /** */ is how its done but:

  1. How do you explain what the Params Stands for?

  2. How do you create a new line, or make a word bold or italic?

Upvotes: 23

Views: 41150

Answers (2)

Peter Ilfrich
Peter Ilfrich

Reputation: 3816

In most major IDEs, such as IntelliJ's IDEA, Apache Netbeans or Eclipse; you can type

/**

and press enter and it will generate the Javadoc for your method, including parameters, return values, etc. You just need to put in the descriptions.

The same applies for class declarations (the Javadoc comment always relates to the following element)

For instance

/**
 * create_instance
 * @param array of attributes for instance containing web, db, arrival_rate, response_time for instance 
 * respectively.
 * @return Instance object
 */

Upvotes: 40

Tomasz Nurkiewicz
Tomasz Nurkiewicz

Reputation: 340983

How do you explain what the Params Stands for?

Use @param tag:

/**
 * @param paramName Explanation of the param
 */
public void foo(String paramName);

How do you create a new line, or make a word bold or italic?

Use standard HTML, i.e. <p></p>, <br/>, <strong> and <em> (or less semantic <b> and <i>)

Upvotes: 26

Related Questions