D is correct, cause name is default value, is not required when use an anotaccion, and TYPE is FIELD not method.
C is incorrect cause name is mandatory if not has a default value
String name() is not mandatory for all instance variables, because it has a default value so C is not correct. type() is specified for all variables because has no default value.
ElementType.FIELD - applies to instance and static variables, and enum values. In this example _name, x and y are all instance variables, and all have type=..., so type() mandatory.
C is incorrect as name needs a default value.
D is correct because of the ElementType.FIELD being used correctly.
B is incorrect because ElementType.TYPE can only be used for: Class, interface (including annotation type), or enum declaration
C is correct
This definition includes the required elements name and type, with name having a default value of an empty string. The Type enum is also defined with the required values INT, STRING, and BOOLEAN. The annotation does not need to specify a target or retention policy to compile.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
ASPushkin
6 months agod7bb0b2
1 year, 1 month agoRoxyFoxy
1 year, 3 months agoRoxyFoxy
1 year, 3 months agoOmnisumem
1 year, 5 months agoAshan_Ozlov
1 year, 4 months ago[Removed]
1 year, 5 months agoStavok
1 year, 6 months agotmuralimanohar
1 year, 7 months agoNayoumi
1 year, 7 months agoAnkit1010
1 year, 12 months agoObalt
2 years ago