在JavaDoc中重写的方法 [英] Overridden methods in JavaDoc

查看:142
本文介绍了在JavaDoc中重写的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在记录我开发的Java程序,并想知道如果我只是记录超类,是否会为继承的方法(被覆盖)生成JavaDoc?

I'm documenting a Java program that I have developed, and wanted to know if JavaDoc will be generated for an inherited method (which is overridden) if I just document the superclass?

如果我有一个名为 Vehicle 的类,其中包含 drive()方法,并且被覆盖的 drive()方法称为 Car 的类,车辆驱动方法的文档将包含在汽车中如果没有将Javadoc放入Car类中的驱动方法?

If I have a class called Vehicle with a drive() method in, and a sub-class called Car with the drive() method overridden, will the documentation for the Vehicles drive method be included in the Cars drive method if no Javadoc is put in the Car class?

推荐答案


[我]想知道如果只记录超类,是否会为继承的方法(被覆盖)生成JavaDoc?

[I] wanted to know if JavaDoc will be generated for an inherited method (which is overridden) if I just document the superclass?

是。如果你没有对子类的javadoc注释,将基于超类javadoc生成javadoc。

Yes. If you don't have javadoc comments on a subclass, javadocs will be be generated based on the superclasses javadoc.

如果你在子类中定义javadocs,它们将替换继承的javadocs,但你可以使用 {@ inheritDoc} 包含子类javadocs中相应的超类javadoc注释。

If you define javadocs in the subclass they will replace the inherited javadocs, but you can use {@inheritDoc} to include the respective superclass javadoc comments in the subclass javadocs.

参考:

  • https://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#inheritingcomments

这篇关于在JavaDoc中重写的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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