Languages
[Edit]
EN

Java classes naming conventions

3 points
Created by:
Emelia
237

In java class names should be:

  • nouns
  • relatively short (2~3 words - easier to read)
  • created in good package

In java class names shouldn't be:

  • shouldn't be too long

 

From oracle website:

Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).

Examples:

  • class Raster;
  • class ImageSprite;

source

 

From Google Java Style Guide:

5.2.2 Class names
Class names are written in UpperCamelCase.

Class names are typically nouns or noun phrases. For example, Character or ImmutableList. Interface names may also be nouns or noun phrases (for example, List), but may sometimes be adjectives or adjective phrases instead (for example, Readable).

There are no specific rules or even well-established conventions for naming annotation types.

Test classes are named starting with the name of the class they are testing, and ending with Test. For example, HashTest or HashIntegrationTest.

source

Java - conventions, naming, best practices

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join