Java Coding Conventions
Java has several naming conventions that are strongly suggested to create orderly
and readable code. Naming conventions are guidelines to write the unique
identifiers of each element type
and readable code. Naming conventions are guidelines to write the unique
identifiers of each element type
- Packages, collections of common classes, must begin with a prefix of
lowercase ASCII letters from the top-level domain names: com, edu, gov,
mil, net, org, or one of the English two-letter codes identifying countries as
specified in ISO Standard 3166, 1981. Example: edu.mit.cs - Class and interface names should be descriptive nouns in mixed case with
the first letter of each word capitalized. Use acronyms only when they are
more common than their alternatives. Example: class Student - Method names must be verbs with the first letter in lowercase and the first
letter of subsequent words in uppercase. Example getAge() - Variable names must be short and descriptive, and capitalized as are
method identifiers. Use of names that begin with an underscore or dollar
sign as well as single character names is discouraged. - Constants are declared with reserved words final and static and cannot be
changed afterward. Example: final static PI = 3.14159;

