Stray At Sign

K

KevinSimonson

I'm taking a look at a piece of Java code right now that says,

/**
* @return number of times the torrent has been downloaded.
*/
public long getDownloaded() {
return downloaded;
}

@Override
public String toString() {
return StringUtils.toString(this);
}

This looks really wierd to me. Obviously it's inside a class
declaration, that I've edited out. But can this compile? Is it
really legal to have "@Override" there before the declaration of
<toString()>, like it's some form of a comment or something? Does
anybody know what the function of this at sign is there?

Kevin Simonson
 
K

KevinSimonson

I'm taking a look at a piece of Java code right now that says,

    /**
     * @return number of times the torrent has been downloaded.
     */
    public long getDownloaded() {
        return downloaded;
    }

    @Override
    public String toString() {
        return StringUtils.toString(this);
    }

This looks really wierd to me.  Obviously it's inside a class
declaration, that I've edited out.  But can this compile?  Is it
really legal to have "@Override" there before the declaration of
<toString()>, like it's some form of a comment or something?  Does
anybody know what the function of this at sign is there?

Kevin Simonson

Furthermore, I found another Java interface whose entire declaration
is:

/**
* Annotation allowing injection of a common TorrentSettings object
across the
* various torrent classes.
*/
@BindingAnnotation
@Target( { FIELD, PARAMETER, METHOD })
@Retention(RUNTIME)
public @interface TorrentSettingsAnnotation {

}

Once again it's got those stray at signs as if they're some alternate
comment symbol. Or are they compiler directives? And what's the
interface declaration "public @interface TorrentSettingsAnnotation"
all about? Is it legal to stick a stay at sign in there to the left
of the <interface> keyword?

Kevin Simonson
 
J

Joshua Cranmer

This looks really wierd to me. Obviously it's inside a class
declaration, that I've edited out. But can this compile? Is it
really legal to have "@Override" there before the declaration of
<toString()>, like it's some form of a comment or something? Does
anybody know what the function of this at sign is there?

Annotations:
<http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.7>
[I tried to find the new-to-Java-5 page, but Oracle really screwed up
the doc pages, so I have no idea how to navigate now].
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top