Hi I was wondering what the @param tag does? I read up a bit on various other stackoverflow questions and the documentation for java but am still confused. Could someone explain it in simpler terms (I'm a beginning programmer)? From my interpretation it basically tells what the type of parameter that a method accepts, is that correct or not? Thank you!
Asked
Active
Viewed 229 times
0
-
Yes, I looked at that answer but was unable to understand the concept fully – Freedom Jan 13 '14 at 02:33
-
1@LoyalKnight Then you could first comment on that question and ask. If after trying to get clarification, the confusion is really enough for a separate question, then it's much more productive for you if you can link to that question here, and explain exactly which parts of it confuses you. That way, no one has to rehash the bit that you *do* understand. – Dennis Meng Jan 13 '14 at 05:39
-
Alright I'll try to do that in the future, I apologize for the incovenience. – Freedom Jan 14 '14 at 13:13
1 Answers
1
It is used to generate the "parameters" section of the javadoc for your class. But it does not affect how your code compiles or runs.
For example, this:
/**
* Returns the string representation of the {@code Object} argument.
*
* @param obj an {@code Object}.
* @return if the argument is {@code null}, then a string equal to
* {@code "null"}; otherwise, the value of
* {@code obj.toString()} is returned.
* @see java.lang.Object#toString()
*/
public static String valueOf(Object obj) {
return (obj == null) ? "null" : obj.toString();
}
Become this:
public static String valueOf(Object obj)
Returns the string representation of the Object argument.
Parameters:
obj
- an Object.Returns: if the argument is
null
, then a string equal to "null"; otherwise, the value ofobj.toString()
is returned.See Also:
Object.toString()

assylias
- 321,522
- 82
- 660
- 783