Return to site

JAVA CERTIFICATION QUESTION: Understanding valid annotation declarations

=>Explore the allowed method return types to see where the code succeeds… or fails.

· java

In this Java SE 11 quiz, which code fragments are valid annotation declarations? Choose two.

A

@interface Lock {
    String resource();
    LocalDateTime start();
    LocalDateTime end();
}

B

@interface ValidNumber {
    int value() = 3;
}

C

@interface Area {
    int[][] points();
}

D

@interface Allowlist {
    String VER = "1.0.0";
    String[] words();
}

E

enum Val {V1,V2,V3,V4,V5,V6};
@interface RandomValues {
    LocalDate lastUpdated = LocalDate.of(2020, 11, 13);
    public abstract Val[] choices() default {Val.V1, Val.V2};
}

 

·Ǝ puɐ ꓷ suoᴉʇdo ǝɹɐ sɹǝʍsuɐ ʇɔǝɹɹoɔ ǝɥꓕ