Java 如何在类中的注释内编写注释?
为了好玩,我试图编写一个使用注释的类,其中包含另一个注释,但我不知道如何编写 我的代码 第一注释 第二个注释,包含第一个注释 带注释的类 我必须将字符串编译代码作为类中FirstAnnotation的实际值的参考放入行中吗?您的类应该是:Java 如何在类中的注释内编写注释?,java,annotations,Java,Annotations,为了好玩,我试图编写一个使用注释的类,其中包含另一个注释,但我不知道如何编写 我的代码 第一注释 第二个注释,包含第一个注释 带注释的类 我必须将字符串编译代码作为类中FirstAnnotation的实际值的参考放入行中吗?您的类应该是: @SecondAnnotation( version = 1, inside = @FirstAnnotation( author = "alessandro" ) ) public class General
@SecondAnnotation(
version = 1,
inside = @FirstAnnotation(
author = "alessandro"
)
)
public class GeneralClass {
/*
* a generic method
*/
public void method() {
System.out.println("method");
}
}
你的班级应该是:
@SecondAnnotation(
version = 1,
inside = @FirstAnnotation(
author = "alessandro"
)
)
public class GeneralClass {
/*
* a generic method
*/
public void method() {
System.out.println("method");
}
}
@FirstAnnotation(author=“something”)@FirstAnnotation(author=“something”)
@FirstAnnotation(
author = "alessandro"
)
@SecondAnnotation(
version = 1,
inside = /*Compilation code: what code? FirstAnnotation, this??*/
)
public class GeneralClass {
/*
* a generic method
*/
public void method() {
System.out.println("method");
}
}
@SecondAnnotation(
version = 1,
inside = @FirstAnnotation(
author = "alessandro"
)
)
public class GeneralClass {
/*
* a generic method
*/
public void method() {
System.out.println("method");
}
}