Naming convention:
In Java, naming conventions for identifiers have been established and suggested by various Java communities such as Sun Microsystems, Netscape, AmbySoft etc.A sample of naming conventions set by Sun Microsystems are listed below, where a name in "CamelCase" is one composed of a number of words joined without spaces, with each word's initial letter in capitals for example "CamelCase".
Naming convention is a rule to follow as you decide what to name your identifiers (e.g. class, methods, packages, variables, constants etc) but it is not mandatory to follow that is why it is known as convention is not rule.
By using standard naming conventions they make their code easier to read for themselves and for other programmers. Readability of java code is important because it means less time is spent trying to understand how the code will compile and run.
Class name:
Class name of first letter should be in uppercase letter, with first letter of every word should be in uppercase letter (e.g. class Add Num), name of class should be a noun. E.g. class Register, class String, class Thread, class ImageString, class Bbstech etc.

naming convention

Method name:
method name should be in uppercase, constant name may also contain digits if appropriate, but not as the first characters. e.g. final static int MAXIMUM_NUMBER_OF_PARTICIPANTS=10, RED, YELLOW, MAX_PRIORITY etc.
Interface name:
Interface name should be begin with uppercase letter and be an adjective (wherever possible) e.g. Runnable, ActionListener etc.
Package name:
Package name should be in lowercase letter e.g. java, lang, SQL, util etc.
Identifier type Rules for naming Examples
Classes Class names should be nouns in UpperCamelCase, with the first letter of every word capitalized. Use whole words avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).
  • class Raster;
  • class ImageSprite;
Methods Methods should be verbs in lowerCamelCase; that is, with the first letter lowercase and the first letters of subsequent words in uppercase.
  • run();
  • runFast();
  • getBackground();
Variables Local variables, instance variables, and class variables are also written in lowerCamelCase. Variable names should not start with underscore (_) or dollar sign ($) characters, even though both are allowed. Certain coding conventions state that underscores should be used to prefix all instance variables, for improved reading and program understanding.
Variable names should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary "throwaway" variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters.
  • int i;
  • char c;
  • float myWidth;
Constants Constants should be written in uppercase characters separated by underscores. Constant names may also contain digits if appropriate, but not as the first character. final static int MAXIMUM_NUM_OF_PARTICIPANTS = 10;