Return to site

JAVA CERTIFICATION QUESTION: Annotation usage and shortcuts

· java,ocp

In this Java SE 11 quiz, assume that you are writing a source code parsing framework. You want to allow the framework’s user to declare a list of programming languages supported by a parser, and to support this you created the following annotation:

Your colleague wants to use that framework to implement a Java parser and started writing the following code:

Which statement is correct? Choose one.

A. The class is valid and compiles as it is.

B. The annotation usage is incorrect and should be @AllowList({"Java"}).

C. The annotation usage is incorrect and should be @AllowList(value={"Java"}).

D. The annotation usage is incorrect and should be @AllowList(value="Java").

 

 

·Ɐ sᴉ ɹǝʍsuɐ ʇɔǝɹɹoɔ ǝɥꓕ