Java is the future !: Names

Wednesday, September 15, 2010

Names

Java is case sensitive. As far as Java is concerned there is no relation whatsoever between the uppercase letter and lower case letter.

The First character of any name can be a upper case letter or a lower case letter a $ sign or an underscore character.

First Character

a-z A-Z $ _

The characters in a name can be anything that the first character can be and also be can any digit.

Other Characters

a-z A-Z $ _ 0-9
 
Class and Interface Names

The names of classes and interfaces are usually in mixed case and begin with a capital letter. These are some examples of class names in the Java API.

ActionEvent
Annotation
BasicStroke
BorderLayout
ContextNotEmptyException
 
Class Members

Members of classes, methods, data items and such are also in mixed case but the usually begins with a lower case letter. These are some examples of class members.

toString
maximum
getContent
startDrag
getMinimumDefaultValue

Constants

The naming convention for constant is that they are usually named with all upper case letters. These also have a tendancy to include the underscore character.

MIN_VALUE
PI
DEFAULT
ENTITY
NO_ACTIVATION_MODE

No comments:

Post a Comment