Different Java programmers have their own style of writing code. While that may work while working alone, it may become difficult to understand and maintain such code in a team environment.
Following standard naming conventions helps make the code readable to yourself and your fellow programmers.
Here are some standard naming conventions that your may refer to :
Package names are written in all lowercase characters. The prefix of package name is always written in all-lowercase ASCII letters and should be one of the top-level domain names, like com, edu, gov, mil, net, org.
The subsequent portions follow organization’s own naming conventions.
Classes and Interfaces
Classes and Interfaces always start with a capital letter, and are CamelCase:
Variables and Methods
Variables and methods always start with a lowercase letter, and are camelCase too:
int someNumber= 10;
public void doSomething();
static final instance variables can never change, and are therefore constant. The convention for constants is to be all uppercase, with any breaks between words represented by an underscore:
public static final int HTTP_OK = 200;
private static final String SUCCESS_RESPONSE = “YES”;
© 2017, www.topjavatutorial.com. All rights reserved. On republishing this post, you must provide link to original post