<p>What is the purpose of annotations in Java? I have this fuzzy idea of them as somewhere in between a comment and actual code. Do they affect the program at run time?</p>

<p>What are their typical usages?</p>

<p>Are they unique to Java? Is there a C++ equivalent?</p>

Also, are they unique to Java, is there a C++ equivalent?
No, but VB and C# have
attributes
which are the same thing.
Their use is quite diverse. One typical Java example,
```
@Override
```
has no effect on the code but it can be used by the compiler to generate a warning (or error) if the decorated method doesn't actually override another method. Similarly, methods can be marked obsolete.
Then there's reflection. When you reflect a type of a class in your code, you can access the attributes and act according to the information found there. I don't know any examples in Java but in .NET this is used by the compiler to generate
(de)serialization
information for classes, determine the
memory layout
of structures and
declare function imports
from legacy libraries (among others). They also control how the IDE form designer works.
/EDIT: Attributes on classes are comparable to tag interfaces (like
Serializable
in Java). However, the .NET coding guidelines say not to use tag interfaces. Also, they only work on class level, not on method level.