我应该在javadoc类和方法注释中写些什么? [英] What should I write in my javadoc class and method comments?

查看:165
本文介绍了我应该在javadoc类和方法注释中写些什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前已经创建了一个应用程序,需要一些帮助来编写我的javadoc.

I currently have created an application and need some help with writing my javadoc for it.

这是代码:

import java.lang.*;
import java.util.*;
import java.io.*;
import java.net.*;

/**
*@author Name HERE 
*@version 1.0
* The Assignment2App public class represents a menu application that will form
* the base of the other source files which will be able to run within this program.
* Users will be able to run another source file within this pogram of which they choose
* by selecting a number specified by the output presented to them on the command window.
*/
public class Assignment2App extends Object
{

/**
*
*
*
*
*/
    public static void main(String[] argStrings) throws Exception
    {
        //Giving the boolean variable called 'exitApp' a value of 'false'
        boolean exitApp = false;

        //Enabling the scanner to read keyboard input
        Scanner keyboard = new Scanner(System.in);

        //Start of the do loop
        do
        {
            //Print out to the command window the name of the program including blank lines to make the program easier to read
            System.out.println("");
            System.out.println("");
            System.out.println("*************************************************************");
            System.out.println("NAME - Programming Assignment 2 - Programming Portfolio");
            System.out.println("*************************************************************");
            System.out.println("");
            System.out.println("");

            System.out.println("0 - Exit");
            System.out.println("1 - Execute Enhanced For Loop");
            System.out.println("2 - Execute For Loop");
            System.out.println("3 - Execute Do While Loop");
            System.out.println("4 - Execute If Statement");
            System.out.println("5 - Execute Switch Statement");
            System.out.println("");

            //Sends output to the command window asking the user to choose an application to execute
            System.out.print("Please choose an application to execute or press 0 to exit > ");

            //Stores the user input into an integer variable called 'choice'
            int choice = keyboard.nextInt();

                //Start of the switch statement, taking the users input 'choice' to select a case
                switch (choice)
                {
                    //This case closes the application by changing the value of the variable called 'exitApp to 'true'
                    case 0:
                    exitApp = true;
                    break;

                    //This case executes the 'EnhancedForLoop.java' main method
                    case 1:
                    EnhancedForLoop.main(null);
                    break;

                    //This case executes the 'ForLoop.java' main method
                    case 2:
                    ForLoop.main(null);
                    break;

                    //This case executes the 'DoWhileLoop.java' main method
                    case 3:
                    DoWhileLoop.main(null);
                    break;

                    //This case executes the 'IfStatement.java' main method
                    case 4:
                    IfStatement.main(null);
                    break;

                    //This case executes the 'SwitchStatement.java' main method
                    case 5:
                    SwitchStatement.main(null);
                    break;

                    //This case is executed if the user enters an incorrect number, the user is then presented with 'Please select a number!'
                    default:
                    System.out.println("Please select a number!");
                    break;
                }
          //Part of the do-while loop, this ends the application once the variable called 'exitApp' is changed to 'true'
        } while (exitApp == false);

    }
}

我不知道为方法"和类"写什么样的东西.我已经使用javadoc查看了Java类文档,但是任何人都可以确认它是否正确吗?

I have no idea what sort of things to write for a 'method' and for a 'class'. I have already had a go at the class Java documentation using javadoc, but can anyone confirm if it's correct?

推荐答案

检查所有选项都有详细说明.包括评论的类示例.

All the options are well explained. A commented class example is included.

方法的描述以动词短语开头.一种方法实现了 操作,因此通常以 动词词组: 获取此按钮的标签. (首选) 此方法获取此按钮的标签. (避免)

Method descriptions begin with a verb phrase. A method implements an operation, so it usually starts with a verb phrase: Gets the label of this button. (preferred) This method gets the label of this button. (avoid)

/界面/字段描述可以省略主题,只需说明 物体.这些API通常描述 事情而不是行动或 行为: 按钮标签. (首选) 此字段是按钮标签. (避免)

Class/interface/field descriptions can omit the subject and simply state the object. These API often describe things rather than actions or behaviors: A button label. (preferred) This field is a button label. (avoid)

这篇关于我应该在javadoc类和方法注释中写些什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆