Javadoc multiple variables on single line

£可爱£侵袭症+ 提交于 2019-12-01 15:53:42

I was curious so I tried it out

/**
 * data stuff
 */
 int x , y ;

The resulting javadoc repeated the same doc comments for both x and y. I imagine this behavior would be useful if two fields were essentially the same with minor differences.

class Circle
{
    ....
    /**
     * center coordinates
     * The x/y coordinate of the center of this circle.
     */
     int x , y ;

unfortunately there is no way to differentiate single line declaration of multiple variables :(

It may be useful to note however that the benefit of this does allow for a single javadoc to provide documentation for categorical variables which may otherwise take unnecessary lines.

/**
 * custom colors (MUST BE DISPOSED!)
 */
Color lightblue, someotherblue, lightred;

of course this can be combined with initialization as well

/**
*  These are the spec's behind batch-box font size / Height / Width
*/
private int iFontHeight = 9, iboxheight = 58, iboxwidth = 125;
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!