java javapackage是什么的javadoc写在哪里

javadoc - java documentation - Stack Overflow
to customize your list.
This site uses cookies to deliver our services and to show you relevant ads and job listings.
By using our site, you acknowledge that you have read and understand our , , and our .
Your use of Stack Overflow’s Products and Services, including the Stack Overflow Network, is subject to these policies and terms.
Join Stack Overflow to learn, share knowledge, and build your career.
or sign in with
i am not able to create documentation for this code,i think my coomad of javadoc is not right, i read about it but don't understand ,can anybody correct by javadoc cammand
{/** documentaion line 1
public static void main(String a[])
{/** documentaion line 2
System.out.println("documentation");
C:\Program Files\Java\jdk1.6.0\bin>javac abc.java
C:\Program Files\Java\jdk1.6.0\bin>java abc
documentation
C:\Program Files\Java\jdk1.6.0\bin>javadoc abc
Loading source files for package abc...
javadoc: warning - No source files for package abc
Constructing Javadoc information...
javadoc: warning - No source files for package abc
javadoc: error - No public or protected classes found to document.
2 warnings
657k13215801718
closed as unclear what you're asking by , , , ,
Please clarify your specific problem or add additional details to highlight exactly what you need.
As it's currently written, it’s hard to tell exactly what you're asking. See the
page for help clarifying this question. If this question can be reworded to fit the rules in the , please .
In your case, you would want to provide the file name instead of a package name.
javadoc abc.java
Then the no source files error message will disappear.
The no public classes error message will still be there - add public before your class declaration. Alternatively, you can pass the -package or -private flag to Javadoc to include non-public classes too.
Then move the documentation comments directly before the declarations you want to comment:
* class documentation here
public class abc
* method documentation here
public static void main(String a[])
* this will be ignored.
System.out.println("documentation");
58.5k12118177
This is old, I know, but I found a solution that worked for me. It isn't package based but it took me forever to figure it out so I figured I'd share it:
javadoc -private *.java
The private option is the key here.
58.5k12118177
2,67072956
As the error message clearly says, Javadoc creates documentation for public or protected classes and methods (members that are visible from outside your package).
You don't have any.
Also, Javadoc takes a package (folder or JAR file), not a classname.
657k13215801718
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
阅读(1340)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_',
blogTitle:'(原创)JavaDoc用法',
blogAbstract:'JavaDoc',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:1,
publishTime:0,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'',
hmcon:'1',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}怎么写javadoc_百度知道
怎么写javadoc
答题抽奖
首次认真答题后
即可获得3次抽奖机会,100%中奖。
采纳数:3070
获赞数:26535
你好,这个的话,可以配置标准化的模板,你可以参考,不让我传附件,粘贴到下面了设置注释模板的入口:&Window-&Preference-&Java-&Code&Style-&Code&Template&然后展开Comments节点就是所有需设置注释的元素啦。现就每一个元素逐一介绍:文件(Files)注释标签:/**&&&*&@Title:&${file_name}&*&@Package&${package_name}&*&@Description:&${todo}(用一句话描述该文件做什么)&*&@author&A18ccms&A18ccms_gmail_com&&&*&@date&${date}&${time}&*&@version&V1.0&&&*/类型(Types)注释标签(类的注释):/**&*&@ClassName:&${type_name}&*&@Description:&${todo}(这里用一句话描述这个类的作用)&*&@author&A18ccms&a18ccms_gmail_com&*&@date&${date}&${time}&*&*&${tags}&*/字段(Fields)注释标签:/**&*&@Fields&${field}&:&${todo}(用一句话描述这个变量表示什么)&*/&构造函数标签:/**&*&&p&Title:&&/p&&*&&p&Description:&&/p&&*&${tags}&*/方法(Constructor&&&Methods)标签:/**&*&@Title:&${enclosing_method}&*&@Description:&${todo}(这里用一句话描述这个方法的作用)&*&@param&${tags}&&&&设定文件&*&@return&${return_type}&&&&返回类型&*&@throws&*/覆盖方法(Overriding&Methods)标签:/*&(非&Javadoc)&*&&p&Title:&${enclosing_method}&/p&&*&&p&Description:&&/p&&*&${tags}&*&${see_to_overridden}&*/代表方法(Delegate&Methods)标签:/**&*&${tags}&*&${see_to_target}&*/&getter方法标签:/**&*&@return&${bare_field_name}&*/setter方法标签:/**&*&@param&${param}&要设置的&${bare_field_name}&*/
<span class="wgt-replyer-all-uname
" data-href="https://zhidao.baidu.com/usercenter?uid=ec705e偶然的必然0
<span class="wgt-replyer-all-card-name3 wgt-replyer-all-card-names" data-href="https://zhidao.baidu.com/usercenter?uid=ec705e偶然的必然0
采纳数:1519
获赞数:4671
在你的类、变量、方法上/**然后回车
iamhappy_2221
iamhappy_2221
采纳数:19
获赞数:47
写好注释后,可以自动生成
为你推荐:
其他类似问题
您可能关注的内容
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。如果你读过Java源码,那你应该已经见到了源码中优美的javadoc。在eclipse 中鼠标指向任何的公有方法都会显示出详细的描述,例如返回值、作用、异常类型等等。
本文主要来自《Thinking in java》的内容以及我在工作中写javadoc的经验。
三种类型的注释文档
注释文档有三种类型,分别对应于注释位置后面的三种元素:类、域和方法。也就说类注释正好位于类定义之前;域注释位于域定义之前;方法注释位于方法定义之前。如图所示:
//: object/Documentation1.java
/** 类注释 */
public class Documentation1 {
/** 域注释 */
/** 方法注释 */
public void f() {}
注意,javadoc只能为public 和protected 成员进行文档注释。private 和包内可访问成员的注释会被忽略掉,所以在输出结果中看不到他们。如果想在输出结果中查看可以使用 -private 进行标记。这样做是因为只有公用的和受保护的成员才能在文件之外被使用。上述代码生成的HTML文档可以在浏览器中查看。
嵌入式HTML
javadoc通过生成的html文档传送HTML命令,这使你能充分利用HTML。
* System.out.println(new date())
从上述注释中我们也能看出,注释是会进行输出的,所以才会有System.out.println(new date()) 这个代码。
还可以用HTML代码格式化注释:
* You can &em&even&/em& insert a list:
* &li& item one
* &li& item two
* &li& item three
注意,每一行星号以及之后的空格内容不会输出到文档中,另外也不要在javadoc中使用标题标签,例如或者。这是因为javadoc会插入自己的标题,而你的标题可能同它们发生冲突。
javadoc标签
1.@see:引用其他类
@see 标签允许用户引用其他类的文档。javadoc会在其生成的HTML文件中,通过@see 标签链接到其他文档。格式如下:
@see 完整类名
@see 完整类名#方法名
每一格式都会在生成的文档里自动加入一个超链接的“See Also”(参见)条目。注意javadoc不会检查我们指定的超链接,不会验证它们是否有效。
2.{ @link package.class#member label }
该标签与@see极其相似,只是它用于行内,并且是用“label” 作为超链接文本而不用“See Also”。
3.{ @docRoot }
该标签产生到文档根目录的相对路径,用于文档树页面的显示超链接
4.{ @inheritDoc }
该标签从当前这个类的最直接的基类中继承相关文档到当前的文档注释中。
5. @version
格式如下:
@version version-information
其中,“version-information”代表任何适合作为版本说明的资料。若在javadoc命令行使用了“-version”标记,就会从生成的HTML文档里提取出版本信息。
6. @author
格式如下:
@author author-information
其中,“author-information”包括您的姓名、电子函件地址或者其他任何适宜的资料。若在javadoc命令行使用了“-author”标记,就会专门从生成的HTML文档里提取出作者信息。
可为一系列作者使用多个这样的标记,但它们必须连续放置。全部作者信息会一起存入最终HTML代码的单独一个段落里。
该标签允许你指定程序代码的最早使用版本,可以在HTML java文档中看到它被用来指定所用的JDK版本的情况。
该标签用于方法文档中,行使如下:
@param parameter-name description
其中,“parameter-name”是指参数列表内的标识符,而“description”代表一些可延续到后续行内的说明文字。一旦遇到一个新文档标记,就认为前一个说明结束。可使用任意数量的说明,每个参数一个。
9. @return
格式如下:
@return description
其中,“description”是指返回值的含义。它可延续到后面的行内。
10. @throws
格式如下:
@throws fully-qualified-class-name description
其中fully-qualified-class-name description给出一个异常类的无歧义的名字,而该异常类在别处定义。description告诉你为什么此特殊类型的异常会在方法调用中出现。
11.@Deprecated
该标签用于之处一些旧特性已由改进的新特性所取代,建议用户不要再使用这些旧特性,因为在不久的将来它们很可能会被删除。如果使用一个标记为@Deprecated的方法,则会引起编译器发布警告。
我们看看JDK8中equals方法的注释是怎样写的:
* Compares this string to the specified object.
The result is {@code
* true} if and only if the argument is not {@code null} and is a {@code
* String} object that represents the same sequence of characters as this
The object to compare this {@code String} against
{@code true} if the given object represents a {@code String}
equivalent to this string, {@code false} otherwise
#compareTo(String)
#equalsIgnoreCase(String)
public boolean equals(Object anObject) {
if (this == anObject) {
if (anObject instanceof String) {
String anotherString = (String)anO
int n = value.
if (n == anotherString.value.length) {
char v1[] =
char v2[] = anotherString.
int i = 0;
while (n-- != 0) {
if (v1[i] != v2[i])
再来看下在eclipse中的显示效果。
{@code } 前面没有介绍过,实际显示效果很容易看出来,就是把空格后的内容显示成代码的样式。
写出言简意赅,便于维护的注释需要长期的练习。除了工作中有意识的使用javadoc以外,阅读源码,模仿源码注释的写法也是不错的选择。
阅读(...) 评论()

我要回帖

更多关于 javapackage用法 的文章

 

随机推荐