gpt4 book ai didi

java - JavaDoc 中带注释的代码示例

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

当我有一个带有注释的代码示例时,我的 JavaDoc 不起作用。

有什么建议吗?

/**
* <pre>
* public class Demo {
* @DemoAnnotation
* public void demoMethod() {
* }
* }
* </pre>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface DemoAnnotation {

最佳答案

更通用的解决方案:{@literal @}

The {@literal} tag denotes literal text. The enclosed text is interpreted as not containing HTML markup or nested javadoc tags. For example, the doc comment text: {@literal a<B>c} displays in the generated HTML page unchanged: a<B>c -- that is, the <B> is not interpreted as bold.

需要 Java 5+

关于java - JavaDoc 中带注释的代码示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2636086/

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