gpt4 book ai didi

java -/*(非javadoc)含义

转载 作者:IT老高 更新时间:2023-10-28 20:32:39 28 4
gpt4 key购买 nike

Possible Duplicate:
Does “/* (non-javadoc)” have a well-understood meaning?

以下语句是什么意思?

    /* (non-Javadoc)
*
* Standard class loader method to load a class and resolve it.
*
* @see java.lang.ClassLoader#loadClass(java.lang.String)
*/
@SuppressWarnings("unchecked")

最佳答案

Javadoc 查找以/** 开头的注释。按照传统,不打算成为 java 文档一部分的方法注释以“/* (non-Javadoc)”开头(至少当您的开发环境是 Eclipse 时)。

顺便说一句,避免使用多行注释inside 方法。例如,避免这种情况:

public void iterateEdges()
{
int i = 0;

/*
* Repeat once for every side of the polygon.
*/
while (i < 4)
{
}
}

以下是首选:

public void iterateEdges()
{
int i = 0;

// Repeat once for every side of the polygon.
while (i < 4)
{
++i;
}
}

原因是你打开了注释掉整个方法的可能性:

/*
public void iterateEdges()
{
int i = 0;

// Repeat once for every side of the polygon.
while (i < 4)
{
++i;
}
}
*/

public void iterateEdges()
{
// For each square edge.
for (int index = 0; index < 4; ++index)
{
}
}

现在您在实现新方法时仍然可以看到旧方法的行为。这在调试时也很有用(以简化代码)。

关于java -/*(非javadoc)含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5172841/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com