When looking through Java documentation or answers for Stack Overflow / programming forum questions, I often see people referring to methods like String#format, Object#clone etc, rather than String.format.

Is this something to do with it being a non-static method, or is this just some convention?

This is quite hard to search for due to most search engines ignoring the '#' symbol so I apologise if this is a duplicate question.

1 Answer 1


The usage of String#format comes from the javadocs and is seen there as {@link package.class#member label} (docs on javadoc).

The generated link to the javadoc for String#format is <a href="../../java/lang/String.html#format(java.lang.String, java.lang.Object...)">format</a> - the # being a link to an anchor within the page - in this case, the String.html page and the #format(java.lang.String,%20java.lang.Object...) anchor. You can see an example of this at Oracle java docs for String#format (note the url and poke around the generated html too)

Nothing more than the leaking of the documentation format out into... other documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.