[Words spelled to me when I was in the first grade ⑪] Please understand the minimum Java coding method. (2nd: Javadoc edition)

――Now, the eleventh article that you can just write as a letter that you are using it as a matter of course. ――I have to leave the daily updates for about two days, and I'm going to jump in time with the feeling that I can replace it with anything. ――Even if only two days have passed, it feels like it's been a while, and you can see how you have continued to escape from reality every day and faced illusions seriously. ――This time, let's send the second copy of Java coding method as a continuation of the previous one.

Java coding practices

―― "Convention" ... I was careful only about the basic naming of classes, methods, variables, etc. ―― “Method” ・ ・ ・ From the learning stage, I didn't consciously describe it, and I thought it would be good if I could understand the meaning.

→ In team development, etc., the description lacks uniformity and readability, causing a great deal of inconvenience.

――Re-learn from the basics about rules and practices in books and online. --Check the human code while looking at sample programs and open source projects.

Javadoc

Overview

--Javadoc is a mechanism to generate HTML API specifications from source code. --By describing in the format, you can easily create a document explaining the defined method or class in Javadoc.

rule

--Write a comment in "/ **" and "\ * /". --The text is basically written in HTML format. --The categories are divided into "description" and "tag section". --"Explanation" is recognized as an HTML sentence. When dividing into multiple lines, use line feed tags such as \

.
--The "tag section" starts with @.
--Some tags can be used multiple times and some tags can be used only once.
--Don't write a description after the tag section description.
--The main types are as follows.
- @author
--Represents the writer (author).
--Can be specified multiple times.
- @version
--Represents the current software version.
--Can be specified multiple times.
- @see

Example

/**
 *Test class
 *
 * @author t_o_d
 * @version 4.6
 * @see <a href="https://www.google.co.jp/">Google</a>
 */
public class Test{
  /**
   *message
   */
  private String message;

  /**
   *age
   */
  private int age;

  /**
   *Information settings
   
   * @param name
name
   * @param number
personal number
    @deprecated Replacement from another method{@link #infoConfiguration(String name, int number)}
   */
  public void setInfo(String name, int number){

  }

  /**
   *Get message
   * @return message
   * 
   * <pre>
   *The setting is{@link com.example.Main#setResult()}
   *The setting is{@linkplain com.example.Main#setResult()}
   * </pre>
   * 
   * @since 4.6
   */
  private int resultCalculation(int firstNumber, int secondNumber) {
    return number1 + number2;
  }

  /**
   *Read
   * @throws java.io.IOException
   *I / O error
   */
  public void readFromFile() throws IOException{

  }
}

Summary

――This time, as it is the second code method, I will write an article while remembering the time when I had a feeling of love at first sight for "automatic document creation in a specified format". ―― "I'd be happy if I could do anything with the minimum amount of request in everything," and I shouldn't let him "dating" even with punishment. I can't help it anymore. ――For that reason, I am living a restricted life, and I pledge to accept my destiny and continue to devote myself to fantasy play and waste investigation, etc., and proudly make an oath that no one can remember. ..

reference

  • https://www.javadrive.jp/javadoc/
    → I referred to this article. Thank you for all the help you have given me.

Recommended Posts

[Words spelled to me when I was in the first grade ⑪] Please understand the minimum Java coding method. (2nd: Javadoc edition)
[Words spelled to me when I was in the first grade ⑩] Please understand the minimum Java coding method. (1st: Naming)
[Words spelled to me when I was in the first grade ⑦] What I want you to include at least with the Visual Studio Code extension
When I wanted to create a method for Premium Friday, it was already in the Java 8 standard API
I want to get the IP address when connecting to Wi-Fi in Java
Java reference to understand in the figure
I was addicted to the roll method
[Promotion of Ruby comprehension (1)] When switching from Java to Ruby, first understand the difference.
The part I was addicted to in "Introduction to Ajax in Java Web Applications" of NetBeans
I was addicted to the NoSuchMethodError in Cloud Endpoints
Java classes and instances to understand in the figure
I tried to implement the Euclidean algorithm in Java
How to batch initialize arrays in Java that I didn't know when I was a beginner