Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What keyword is used to create a custom annotation in Java?
Think about how other interfaces are declared in Java.
What does the @Target annotation specify?
Recall different types of program elements.
What is the purpose of custom annotations in Java?
Think about what annotations generally do.
True or False: Custom annotations can have methods.
Think about the structure of annotations.
Create a custom annotation named @Version that includes a String field value indicating the version of a method. Apply this annotation to one of your methods.
Start by defining the annotation using `@interface`.
Write code to retrieve and print the version number of the method annotated with @Version. Assume the method to retrieve is marked with this annotation.
Think about how you can access a method's annotations with reflection.
5 more questions in this section. Enroll free to practise them all.
Enroll free