注释方法可以接受参数吗?

时间:2015-11-06 11:52:59

标签: java annotations

我很少编写注释,但它在java框架中使用得很好。

我调查了注释来源,我有一个问题

所有注释方法都源于我所看到的并不接受参数。

示例(来自spring-mvc):

//makes a for-loop that prints out the row
for(int row = 0; row < x.length; row++)
{
    //makes a for-loop that prints out the column
    for(int column = 0; column < x[row].length; column++)
    {
        //sysouts the rows & columns
        System.out.print(x[row][column] + "\t");
    }
    System.out.println();
}

注释方法可以接受参数吗?

1 个答案:

答案 0 :(得分:5)

简答:没有

注释实际上没有方法。它们具有属性(带有可选的默认值),它们在语法上与方法类似。

相关问题