Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1036897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:46:43+00:00 2026-05-16T14:46:43+00:00

java.lang.annotation.ElementType : A program element type. The constants of this enumerated type provide a

  • 0

java.lang.annotation.ElementType:

A program element type. The constants of this enumerated type provide a simple classification of the declared elements in a Java program. These constants are used with the Target meta-annotation type to specify where it is legal to use an annotation type.

There are the following constants:

  • ANNOTATION_TYPE – Annotation type declaration
  • CONSTRUCTOR – Constructor declaration
  • FIELD – Field declaration (includes enum constants)
  • LOCAL_VARIABLE – Local variable declaration
  • METHOD – Method declaration
  • PACKAGE – Package declaration
  • PARAMETER – Parameter declaration
  • TYPE – Class, interface (including annotation type), or enum declaration

Can someone explain what each of them are (where they’d be annotated in actual code)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:46:43+00:00Added an answer on May 16, 2026 at 2:46 pm

    This summarizes the main ones:

    @CustomTypeAnnotation
    public class MyAnnotatedClass {
      @CustomFieldAnnotation
      private String foo;
    
      @CustomConstructorAnnotation
      public MyAnnotatedClass() {
      }
    
      @CustomMethodAnnotation
      public String bar(@CustomParameterAnnotation String str) {
        @CustomLocalVariableAnnotation String asdf = "asdf";
        return asdf + str;
      }
    }
    

    ANNOTATION_TYPE is an annotation on another annotation, like this:

    @CustomAnnotationTypeAnnotation
    public @interface SomeAnnotation {
      ..
    }
    

    Package is defined in a package-info.java file in the package, like this:

    @CustomPackageLevelAnnotation
    package com.some.package;
    
    import com.some.package.annotation.PackageLevelAnnotation;
    

    For more info on PACKAGE annotations see here and here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 530k
  • Answers 530k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer why not just tar the whole thing? no need to… May 16, 2026 at 11:30 pm
  • Editorial Team
    Editorial Team added an answer Blob decryption works just fine, "54657374696e67" is "Testing", only hex-encoded.… May 16, 2026 at 11:30 pm
  • Editorial Team
    Editorial Team added an answer It's not really more Pythonic, but you can simply the… May 16, 2026 at 11:30 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

What is the purpose of these java.lang.annotation imports in this code? Why are they
Can anyone explain in a clear way the practical differences between the java.lang.annotation.RetentionPolicy constants
I defined an annotation as follows import java.lang.annotation.ElementType import java.lang.annotation.Inherited import java.lang.annotation.Retention import java.lang.annotation.RetentionPolicy
Here is a test class: import java.lang.annotation.Annotation; import java.lang.reflect.Method; public class TestAnnotations { @interface
Consider the following code: A.java: import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) @interface A{} C.java: import
I jave a simple Java bean with 4 attributes, getter/setter, and some overided methods
what is annotation class. what is the use of it in java/android. In iphone
I have set up an annotation that will be used to keep track of
I'm trying to use Java annotations, but can't seem to get my code to
If a class defined an annotation, is it somehow possible to force its subclass

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.