Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naming convention when casually referring to methods in Java

Is there a Java convention to refer to methods, static and otherwise, any specific one or the whole overload, etc?

e.g.

  • String.valueOf - referring to all overloads of static valueOf
    • String.valueOf(char) - specific overload, formal parameter name omittable?
  • String.split - looks like a static method, but actually an instance method
    • Maybe aString.split is the convention?
    • Or maybe String().split?
  • String#split - I've seen this HTML anchor form too, which I guess is javadoc-influenced

Is there an authoritative recommendation on how to clearly refer to these things?

like image 535
polygenelubricants Avatar asked Oct 26 '25 17:10

polygenelubricants


1 Answers

Using Class.methodName to refer to all overloads and Class.methodName(type) to refer to a specific overload is indeed the convention (as recommended by sun in this style guide for javadocs). However there is no convention to distinguish between static and non-static methods (though aString.split would make sense).

like image 145
sepp2k Avatar answered Oct 28 '25 06:10

sepp2k