Results 1 to 6 of 6

Thread: '@' Symbol

  1. #1
    AedonetLIRA is offline Member
    Join Date
    Oct 2010
    Posts
    22
    Rep Power
    0

    Default '@' Symbol

    What does the '@' symbol mean?

    More specifically:
    Java Code:
    @RemoteView
    public class aClass ... //rest of class stuff
    My best guess is it links to an interface somehow but I have no idea how or why....

    Thank for any help or links.
    ~Aedon
    Last edited by AedonetLIRA; 12-08-2010 at 06:56 PM. Reason: Specificity

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    786
    Rep Power
    5

  3. #3
    AedonetLIRA is offline Member
    Join Date
    Oct 2010
    Posts
    22
    Rep Power
    0

    Default

    Ok so in the example I used:

    Java Code:
    @RemoteView // an annotation but a class
    public class aClass ...
    has no real meaning even though RemoteView is a class?

  4. #4
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    786
    Rep Power
    5

    Default

    eRaaaa Today, 06:58 PM
    AedonetLIRA Today 07:02 PM

    have you read the links? :eek:

  5. #5
    AedonetLIRA is offline Member
    Join Date
    Oct 2010
    Posts
    22
    Rep Power
    0

    Default

    I did and understand that they are primarily used for documentation and the three compiler annotations. What I don't get is the last section on the second link, the annotations used by the compiler.

    I'm struggling to see how they connect in a program. I'm reviewing a bit of source that creates an interface using two annotations, and then in a seperate class makes an annotation to the interface. Does this connect something?

    snippet from what I'm looking at
    Java Code:
    @Target({ ElementType.TYPE })
    @Retention(RetentionPolicy.RUNTIME)
    public @interface RemoteView {
    }
    ...
    @RemoteView
    public class Button ...
    Last edited by AedonetLIRA; 12-08-2010 at 08:34 PM. Reason: Further research

  6. #6
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    Annotations have a lot of uses (unit testing being a big one - JUnit). As its being retained to runtime, chances are some other class uses reflection to look at the class and decide what to do based on the annotations used on the class.
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

Similar Threads

  1. The $ symbol in a string
    By SwissR in forum New To Java
    Replies: 9
    Last Post: 07-23-2010, 05:16 PM
  2. Can not find symbol ???
    By AliceNewbie in forum New To Java
    Replies: 1
    Last Post: 02-17-2010, 01:44 AM
  3. Yet another Cannot Resolve Symbol
    By Gabinka in forum New To Java
    Replies: 5
    Last Post: 03-27-2009, 10:28 PM
  4. Replies: 9
    Last Post: 10-18-2008, 08:26 PM
  5. Replies: 3
    Last Post: 05-01-2008, 08:30 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •