Annotations in Java

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/14

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

15 Terms

1
New cards

What is an annotation in Java?

A special form of metadata that provides data about a program but is not part of the program itself.

2
New cards

What is the purpose of annotations in Java?

To provide information to the compiler or runtime for processing code.

3
New cards

What symbol is used to define an annotation?

The @ symbol.

4
New cards

Name a common built-in annotation.

@Override

5
New cards

What does @Override do?

Indicates that a method is intended to override a method in a superclass.

6
New cards

What does @Deprecated mean?

Marks a method or class as outdated and warns that it should not be used.

7
New cards

What does @SuppressWarnings do?

Instructs the compiler to suppress specific warnings.

8
New cards

What is a meta-annotation?

An annotation that applies to other annotations, like @Retention and @Target.

9
New cards

What does @Retention specify?

How long the annotation should be retained (SOURCE, CLASS, or RUNTIME).

10
New cards

What does @Target define?

The kinds of program elements an annotation can be applied to (e.g., METHOD, FIELD, TYPE).

11
New cards

What does @Documented do?

Indicates that the annotation should be included in the generated Javadoc.

12
New cards

What is @Inherited used for?

Indicates that an annotation should be inherited by subclasses.

13
New cards

How do you define a custom annotation?

Using @interface keyword.

14
New cards

Can annotations have parameters?

Yes, they can define methods that act as elements with default or required values.

15
New cards

Where are annotations commonly used?

In frameworks like Spring, JUnit, and Hibernate for configuration and behavior control.

Explore top flashcards

Cold War in China
Updated 889d ago
flashcards Flashcards (31)
MICRO
Updated 997d ago
flashcards Flashcards (113)
AP Lit Vocab 2
Updated 401d ago
flashcards Flashcards (20)
MKT 300 Hapke Exam 2
Updated 366d ago
flashcards Flashcards (71)
civil war
Updated 1102d ago
flashcards Flashcards (25)
Cold War in China
Updated 889d ago
flashcards Flashcards (31)
MICRO
Updated 997d ago
flashcards Flashcards (113)
AP Lit Vocab 2
Updated 401d ago
flashcards Flashcards (20)
MKT 300 Hapke Exam 2
Updated 366d ago
flashcards Flashcards (71)
civil war
Updated 1102d ago
flashcards Flashcards (25)