Java Method Naming Convention

In this post, we will discuss the Java methods naming conventions with examples.

Read complete Java naming conventions at https://www.javaguides.net/2018/08/java-standard-naming-conventions.html.

Java Methods naming conventions

Methods always should be verbs. They represent action and the method name should clearly state the action they perform. The method name can be single or 2-3 words as needed to clearly represent the action. Words should be in camel case notation.
Examples:
    public List <Customer> getCustomers();

    public void saveCustomer(Customer theCustomer);

    public Customer getCustomer(int theId);

    public void deleteCustomer(int theId);
More Examples:
getName()
computeTotalWidth()
actionPerformed()
main()
print()
println()

Reference



Comments