what does @ in code comments mean?

  • Thread starter ACompetitorsChallenge
  • Start date
A

ACompetitorsChallenge

I have this code comment and was uncertain it's comprehensive
meaning...
/**
* Singleton access method.
*
* @return Singleton
*/
I just learned what the Singleton Design pattern means :
how multiple objects can share a common object without having to know
if it already exists

but what does this comment line refer to ?
@return Singleton
I also see @param in my code also.. what does the @ mean here?

what do these comments mean ? are they signifigant?
or does it means something simple like this.instance at runtime?...

thx for your more advanced insight...
 
L

Lew

I have this code comment and was uncertain it's comprehensive
meaning...
    /**
     * Singleton access method.
     *
     * @return Singleton
     */
I just learned what the Singleton Design pattern means :
how multiple objects can share a common object without having to know
if it already exists

but what does this comment line refer to ?
@return Singleton
I also see @param  in my code also.. what does the @ mean here?

what do these comments mean ? are they signifigant?
or does it means something simple like this.instance at runtime?...

These are Javadoc comments,
<http://java.sun.com/javase/6/docs/technotes/guides/javadoc/
index.html>
and the "@" signifies Javadoc tags in them.
<http://java.sun.com/javase/6/docs/technotes/tools/solaris/
javadoc.html#javadoctags>

These tags cause certain information to be included in the Javadocs.

I recommend java.sun.com as the first place to look for all knowledge
Java.
 
M

Mark Space

Lew said:
I recommend java.sun.com as the first place to look for all knowledge
Java.


To be fair, Google ignores punctuation, and searching for "@return" is
nearly impossible, at least as far as I can tell. If you don't already
know to search for "javadoc" for this sort of thing, it's probably
almost impossible to find.

To the OP: there are also @ in the code too, not just comments. You can
make your own, or use built-in ones.

Make your own:
<http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html>

Built-in annotations:
<http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.6.1>
 
L

Lew

To be fair, Google ignores punctuation, and searching for "@return" is
nearly impossible, at least as far as I can tell.  If you don't already
know to search for "javadoc" for this sort of thing, it's probably
almost impossible to find.

Or easy with some creative spelling:
<http://www.google.com/search?q=Java+comment+at-sign+return>

But I was recommending going to java.sun.com, not Google:
<http://search.sun.com/main/index.jsp?qt=comment+"at+sign"&col=main-
developer-reference>
 
R

Roedy Green

/**
* Singleton access method.
*
* @return Singleton
*/

@ signs have two uses, Javadoc for structured comments and annotations
primarily for inserting information into the class files that Java
does not use, but some other app might.

See http://mindprod.com/jgloss/javadoc.html

http://mindprod.com/jgloss/annotations.html

--
Roedy Green Canadian Mind Products
http://mindprod.com

"Don’t worry about the world coming to an end today.
It is already tomorrow in Australia."
~ Charles Schulz
 

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,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top